A bidirectional metering method, device, medium and product applied to abnormal flow under pipe network disturbance

By constructing a periodic flow time difference sequence and flow direction coding, the problem of metering error of ultrasonic water meters under pipeline disturbance conditions is solved, and more accurate flow calculation is achieved.

CN119164458BActive Publication Date: 2026-07-07HANGZHOU SHANKE INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU SHANKE INTELLIGENT TECH CO LTD
Filing Date
2024-09-23
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing ultrasonic water meters have difficulty accurately identifying and measuring forward and reverse flow when there is disturbance in the pipeline network or pressure imbalance, resulting in net cumulative flow error and affecting the fairness and accuracy of measurement.

Method used

By acquiring sampling data from ultrasonic water meters, determining the periodic flow time difference and flow direction code, constructing a periodic flow time difference sequence, and calculating the cumulative flow based on the flow direction code and time difference sequence, bidirectional metering under pipeline disturbances is achieved.

Benefits of technology

It improves the accuracy and rationality of bidirectional metering under pipeline disturbance conditions, ensuring the accuracy and impartiality of flow measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119164458B_ABST
    Figure CN119164458B_ABST
Patent Text Reader

Abstract

The application discloses a bidirectional metering method and device applied to abnormal flow under pipe network disturbance, a medium and a product, relates to the technical field of ultrasonic water metering, and comprises the following steps: determining the period flow time difference and the period flow direction code corresponding to each period based on sampling data; taking the period flow direction code as an index, and constructing a period flow time difference sequence in chronological order; and determining the cumulative flow corresponding to the current flow sampling period sequence based on the period flow time difference sequence. The application can improve the bidirectional metering precision applied to abnormal flow under pipe network disturbance by constructing the period flow time difference sequence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of ultrasonic water meter measurement technology, and in particular to a bidirectional metering method, equipment, medium and product applied to abnormal flow under pipeline disturbance. Background Technology

[0002] With the development of electronic technology, smart water meters have evolved from version 1.0 to 2.0, and are gradually moving towards smart water meter 3.0, providing more accurate pipeline monitoring and flow measurement. Ultrasonic water meters, with their advantages of high measurement accuracy, large range ratio, and low pressure loss, are widely used in water measurement scenarios such as large-diameter water supply networks.

[0003] Affected by factors such as temperature changes, air bubbles in the pipeline, and pressure fluctuations, the water flow in the ultrasonic water meter pipeline fluctuates back and forth, which may generate positive and negative oscillating flow. In the existing algorithm scheme, the net cumulative flow is the positive cumulative flow minus the negative cumulative flow. Due to the error in positive and negative metering, when there is pipeline disturbance or pressure imbalance before and after the water meter, and the user has not used water, the abnormal flow cannot be correctly identified. The positive and negative metering will result in a certain net cumulative flow, thus affecting the fairness of metering. Summary of the Invention

[0004] The purpose of this application is to provide a bidirectional metering method, device, medium, and product for use under abnormal flow conditions caused by pipeline disturbances, which can improve the accuracy of bidirectional metering under such conditions.

[0005] To achieve the above objectives, this application provides the following solution:

[0006] Firstly, this application provides a bidirectional metering method for abnormal flow under pipeline disturbances, including:

[0007] Acquire sampling data from the ultrasonic water meter within the current flow sampling cycle sequence;

[0008] Based on the sampled data, determine the periodic flow time difference and periodic flow direction code for each period corresponding to the current flow sampling period sequence;

[0009] Using periodic flow direction codes as indexes, construct periodic flow time difference sequences in chronological order;

[0010] Based on the periodic flow time difference sequence, the cumulative flow corresponding to the current flow sampling period sequence is determined.

[0011] Optionally, based on the sampled data, determining the periodic flow time difference and periodic flow direction code for each period corresponding to the current flow sampling period sequence includes:

[0012] The current period is determined by defining any period within the current flow sampling period sequence.

[0013] Obtain the total number of samplings n of the ultrasonic water meter in the current cycle;

[0014] Based on the sampled data, the sampling flow time difference and sampling direction for each sampling within the current period are determined; the sampling direction includes forward and reverse directions.

[0015] The number of times the sampling flow direction is positive within the current period is obtained as the positive flow time difference count m;

[0016] The number of times the sampling flow direction is reversed within the current period is obtained as the reverse flow time difference count k.

[0017] Based on the total number of samplings n, the number of forward flow time differences m, and the number of reverse flow time differences k, the cycle flow direction code for the current cycle is determined;

[0018] Based on the cycle flow direction encoding of the current cycle, as well as the sampling flow time difference and sampling flow direction at each sampling in the current cycle, the cycle flow time difference of the current cycle is determined.

[0019] Update the current cycle and return to the step "Get the total number of sampling times n of the ultrasonic water meter in the current cycle" until the current flow sampling cycle sequence is traversed to obtain the cycle flow time difference and cycle flow direction code for each cycle corresponding to the current flow sampling cycle sequence.

[0020] Optionally, based on the sampled data, determining the sampling flow time difference and sampling direction for each sample within the current period includes:

[0021] Let the number of samples i = 1;

[0022] The sampling data at the i-th sampling time is determined as the current sampling data; the current sampling data includes the downstream flight time T of the sound wave at the i-th sampling time. d and the sound wave retrograde flight time T at the i-th sampling time u ;

[0023] Determine the time T of the sound wave's reverse flow during the i-th sample in the current sampled data. u Is it greater than or equal to the downstream flight time T of the sound wave at the i-th sampling? d The first judgment result is obtained;

[0024] If the first judgment result is yes, then the sampling direction at the i-th sampling time is determined to be positive;

[0025] Determine the sound wave retrograde flight time T at the i-th sampling. u The time of flight of the sound wave downstream at the i-th sampling point is T d The difference is the sampling flow time difference;

[0026] If the first judgment result is negative, then the sampling flow direction during the i-th sampling is determined to be reversed;

[0027] Determine the downstream flight time T of the sound wave at the i-th sampling. d Compared with the sound wave retrograde flight time T at the i-th sampling time u The difference is the sampling flow time difference;

[0028] Determine whether the number of samples i has reached the total number of samples n in the current period, and obtain the second determination result;

[0029] If the second judgment result is negative, then the value of the sampling number i is incremented by 1, and the process returns to the step "determine the sound wave retrograde flight time T at the i-th sampling in the current sampled data". u Is it greater than or equal to the downstream flight time T of the sound wave at the i-th sampling? d "and thus the first judgment result was obtained";

[0030] If the second judgment result is yes, then the sampling flow time difference and sampling direction for each sampling in the current period are obtained.

[0031] Optionally, based on the total number of samplings n, the number of forward flow time differences m, and the number of reverse flow time differences k, the periodic flow direction code for the current period is determined, including:

[0032] Obtain the threshold for the number of valid samples;

[0033] The sum of the forward flow time difference count m and the reverse flow time difference count k is determined as the effective sampling count;

[0034] Determine whether the number of valid samples has reached the threshold for the number of valid samples, and obtain a third determination result;

[0035] If the third judgment result is negative, then set the cycle flow direction code of the current cycle to 3; a cycle flow direction code of 3 indicates that the current cycle flow measurement is incorrect.

[0036] If the third judgment result is yes, then let the difference between the total number of samplings n and the preset amount be the second judgment amount;

[0037] Determine whether the forward flow time difference count m is less than the reverse flow time difference count k to obtain the fourth determination result;

[0038] If the fourth judgment result is negative, then the difference between the number of forward flow time difference m and the number of reverse flow time difference k is determined as the third judgment quantity;

[0039] Determine whether the third decision value is less than the second decision value to obtain the fifth decision result;

[0040] If the fifth judgment result is negative, then set the cycle flow direction code of the current cycle to 1; a cycle flow direction code of 1 indicates that the flow direction of the current cycle is positive.

[0041] If the fifth judgment result is yes, then set the cycle flow direction code of the current cycle to 0; a cycle flow direction code of 0 indicates that the flow direction of the current cycle has no definite direction.

[0042] If the fourth judgment result is yes, the difference between the number of reverse flow time difference k and the number of forward flow time difference m is determined as the fourth judgment quantity;

[0043] Determine whether the fourth decision value is less than the second decision value to obtain the sixth decision result;

[0044] If the result of the sixth judgment is negative, then set the cycle flow direction code of the current cycle to 2; the cycle flow direction code equal to 2 indicates that the flow direction of the current cycle is reversed.

[0045] If the sixth judgment result is yes, then set the cycle flow code of the current cycle to 0.

[0046] Optionally, based on the periodic flow direction encoding of the current period, and the sampling flow time difference and sampling flow direction at each sampling time within the current period, the periodic flow time difference of the current period is determined, including:

[0047] The effective sampling flow time difference is determined by identifying the time difference of all sampling flows within the current period that have the same sampling direction as the periodic flow direction.

[0048] The arithmetic mean of all valid sampled flow time differences is determined as the periodic flow time difference for the current period.

[0049] Optionally, based on the periodic flow time difference sequence, determining the cumulative flow corresponding to the current flow sampling period sequence includes:

[0050] In chronological order, the first cycle whose flow direction code is not equal to 3 is obtained from back to front as the base cycle;

[0051] The periodic flow direction code of the base period is determined as the base period flow direction code;

[0052] Based on the reference period and the periodic flow time difference sequence, determine the instantaneous flow corresponding to the current flow sampling period sequence;

[0053] The product of the instantaneous flow rate corresponding to the current flow sampling period sequence and the pipeline area is determined as the current cumulative flow rate;

[0054] Obtain positive and negative cumulative traffic;

[0055] When the baseline period flow direction code is equal to 1, the current cumulative flow is increased to the positive cumulative flow;

[0056] When the baseline period flow code is equal to 2, the current cumulative flow is increased to the reverse cumulative flow.

[0057] Optionally, based on the reference period and the periodic flow time difference sequence, determining the instantaneous flow corresponding to the current flow sampling period sequence includes:

[0058] The element number of the reference period in the current flow sampling period sequence is obtained as the reference period number;

[0059] The fifth determination factor is determined by setting half the number of elements in the current flow sampling period sequence.

[0060] Determine whether the reference period number is greater than the fifth determination value to obtain the seventh determination result;

[0061] If the seventh judgment result is negative, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0;

[0062] If the seventh judgment result is yes, then determine whether the base period flow direction code is equal to 0, and obtain the eighth judgment result;

[0063] If the eighth judgment result is yes, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0;

[0064] If the eighth judgment result is negative, the number of elements with an index not equal to 3 in the periodic flow time difference sequence is obtained as the first quantity C;

[0065] Obtain the reference element sequence in the periodic flow time difference sequence; all elements in the reference element sequence are continuous in the periodic flow time difference sequence, and the index of all elements in the reference element sequence in the periodic flow time difference sequence is equal to the reference periodic flow direction code;

[0066] The current reference element sequence is determined by identifying the sequence with the most elements.

[0067] The number of elements in the current baseline element sequence is determined as the second quantity G;

[0068] When the baseline periodic flow direction code is equal to 1, it is determined whether the first condition is met, and the ninth judgment result is obtained; the first condition is G>1 and G>(K / 2); K is the number of elements in the periodic flow time difference sequence whose index is equal to the baseline periodic flow direction code;

[0069] If the ninth judgment result is yes, then the arithmetic mean of all elements in the current benchmark element sequence is the benchmark periodic flow time difference;

[0070] Based on the baseline periodic flow time difference and the relationship between flow time difference and instantaneous flow, the instantaneous flow corresponding to the current flow sampling period sequence is determined;

[0071] If the ninth judgment result is negative, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0;

[0072] When the base period flow code is equal to 2, it is determined whether the second condition is met, and the tenth judgment result is obtained; the second condition is G>1 and G>(C / 2);

[0073] If the tenth judgment result is yes, then the arithmetic mean of all elements in the current benchmark element sequence is the benchmark periodic flow time difference;

[0074] Based on the baseline periodic flow time difference and the relationship between flow time difference and instantaneous flow, the instantaneous flow corresponding to the current flow sampling period sequence is determined;

[0075] If the tenth judgment result is negative, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0.

[0076] Secondly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described bidirectional metering method applied to abnormal flow under pipeline disturbance.

[0077] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described bidirectional metering method applied to abnormal flow under pipeline disturbances.

[0078] Fourthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described bidirectional metering method applied to abnormal flow under pipeline disturbances.

[0079] According to the specific embodiments provided in this application, the following technical effects are disclosed:

[0080] This application provides a bidirectional metering method, device, medium, and product applied to abnormal flow under pipeline disturbances. It acquires sampling data from an ultrasonic water meter within the current flow sampling cycle sequence; based on the sampling data, it determines the cycle flow time difference and cycle flow direction code for each cycle corresponding to the current flow sampling cycle sequence; using the cycle flow direction code as an index, it constructs a cycle flow time difference sequence in chronological order; based on the cycle flow time difference sequence, it determines the cumulative flow corresponding to the current flow sampling cycle sequence; by constructing the cycle flow time difference sequence, it accurately measures abnormal flow under bidirectional pipeline disturbances and judges the disturbed flow, thereby improving the accuracy and rationality of metering. Attached Figure Description

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

[0082] Figure 1 This is a flowchart of a bidirectional metering method applied to abnormal flow under pipeline disturbance in one embodiment of this application;

[0083] Figure 2 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0084] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0085] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0086] In one exemplary embodiment, such as Figure 1 As shown, a bidirectional metering method for abnormal flow under pipeline disturbances is provided, including:

[0087] Step 101: Obtain the sampling data of the ultrasonic water meter within the current flow sampling cycle sequence.

[0088] Step 102: Based on the sampled data, determine the periodic flow time difference and periodic flow direction code for each period corresponding to the current flow sampling period sequence.

[0089] Step 103: Using the periodic flow direction code as an index, construct the periodic flow time difference sequence in chronological order.

[0090] Step 104: Based on the periodic flow time difference sequence, determine the cumulative flow corresponding to the current flow sampling period sequence.

[0091] Step 102 includes:

[0092] Determine any period within the current traffic sampling period sequence as the current period.

[0093] Obtain the total number of samplings n of the ultrasonic water meter in the current cycle.

[0094] Based on the sampled data, determine the sampling flow time difference and sampling direction for each sampling within the current period. The sampling direction includes forward and reverse directions.

[0095] The number of times the sampling flow direction is positive within the current period is obtained as the positive flow time difference count m.

[0096] The number of times the sampling flow direction is reversed within the current period is obtained as the reverse flow time difference count k.

[0097] Based on the total number of samplings n, the number of forward flow time differences m, and the number of reverse flow time differences k, the periodic flow direction code for the current period is determined.

[0098] Based on the cycle flow direction encoding of the current cycle, as well as the sampling flow time difference and sampling flow direction at each sampling time in the current cycle, the cycle flow time difference of the current cycle is determined.

[0099] Update the current cycle and return to the step "Get the total number of sampling times n of the ultrasonic water meter in the current cycle" until the current flow sampling cycle sequence is traversed to obtain the cycle flow time difference and cycle flow direction code for each cycle corresponding to the current flow sampling cycle sequence.

[0100] Determine the sampling flow time difference and sampling direction for each sampling within the current period, including:

[0101] Let the number of samplings i = 1.

[0102] The sampled data at the i-th sampling point is determined as the current sampled data. The current sampled data includes the downstream flight time T of the sound wave at the i-th sampling point. d and the sound wave retrograde flight time T at the i-th sampling time u .

[0103] Determine the time T of the sound wave's reverse flow during the i-th sample in the current sampled data. u Is it greater than or equal to the downstream flight time T of the sound wave at the i-th sampling? d Thus, the first judgment result was obtained.

[0104] If the first judgment result is yes, then the sampling direction at the i-th sampling time is determined to be positive.

[0105] Determine the sound wave retrograde flight time T at the i-th sampling. u The time of flight of the sound wave downstream at the i-th sampling point is T d The difference is the sampling flow time difference.

[0106] If the first judgment result is negative, then the sampling flow direction at the i-th sampling time is determined to be reversed.

[0107] Determine the downstream flight time T of the sound wave at the i-th sampling. d Compared with the sound wave retrograde flight time T at the i-th sampling time u The difference is the sampling flow time difference.

[0108] Determine whether the number of samples i has reached the total number of samples n in the current period to obtain the second determination result.

[0109] If the second judgment result is negative, then the value of the sampling number i is incremented by 1, and the process returns to the step "determine the sound wave retrograde flight time T at the i-th sampling in the current sampled data". u Is it greater than or equal to the downstream flight time T of the sound wave at the i-th sampling? d "and thus obtain the first judgment result."

[0110] If the second judgment result is yes, then the sampling flow time difference and sampling direction for each sampling in the current period are obtained.

[0111] Based on the total number of samples n, the number of forward flow time differences m, and the number of reverse flow time differences k, the periodic flow direction code for the current period is determined, including:

[0112] Obtain the threshold for the number of valid samples.

[0113] The sum of the forward flow time difference count m and the reverse flow time difference count k is determined as the effective sampling count.

[0114] The third judgment result is obtained by determining whether the number of valid samples has reached the threshold of the number of valid samples.

[0115] If the third judgment result is negative, then set the cycle flow direction code for the current cycle to 3. A cycle flow direction code of 3 indicates that the flow measurement for the current cycle is incorrect.

[0116] If the third judgment result is yes, then let the difference between the total number of samplings n and the preset amount be the second judgment amount.

[0117] The fourth judgment result is obtained by determining whether the forward flow time difference count m is less than the reverse flow time difference count k.

[0118] If the fourth judgment result is negative, then the difference between the forward flow time difference count m and the reverse flow time difference count k is determined as the third judgment quantity.

[0119] Determine whether the third decision value is less than the second decision value to obtain the fifth decision result.

[0120] If the fifth judgment result is negative, then set the cycle flow direction code of the current cycle to 1. A cycle flow direction code of 1 indicates that the flow direction of the current cycle is positive.

[0121] If the fifth judgment result is yes, then set the cycle flow direction code of the current cycle to 0. A cycle flow direction code of 0 indicates that the flow direction of the current cycle has no definite direction.

[0122] If the fourth judgment result is yes, the difference between the number of reverse flow time difference k and the number of forward flow time difference m is determined as the fourth judgment quantity.

[0123] Determine whether the fourth decision quantity is less than the second decision quantity to obtain the sixth decision result.

[0124] If the result of the sixth judgment is negative, then set the cycle flow direction code of the current cycle to 2. A cycle flow direction code of 2 indicates that the flow direction of the current cycle is reversed.

[0125] If the result of the sixth judgment is yes, then set the cycle flow code of the current cycle to 0.

[0126] Based on the cycle flow direction encoding of the current cycle, and the sampling flow time difference and sampling flow direction at each sampling time within the current cycle, the cycle flow time difference of the current cycle is determined, including:

[0127] The effective sampling flow time difference is determined by identifying the time difference of all sampling flows with the same sampling direction as the periodic flow direction within the current period.

[0128] The arithmetic mean of all valid sampled flow time differences is determined as the periodic flow time difference for the current period.

[0129] Step 104 includes:

[0130] In chronological order, the first cycle whose flow code is not equal to 3 is taken as the base cycle.

[0131] The periodic flow direction code for determining the base period is the base period flow direction code.

[0132] Based on the baseline period and the periodic flow time difference sequence, the instantaneous flow corresponding to the current flow sampling period sequence is determined.

[0133] The product of the instantaneous flow rate corresponding to the current flow sampling period sequence and the pipeline area is determined as the current cumulative flow rate.

[0134] Get the positive and negative cumulative traffic.

[0135] When the baseline period flow direction code is equal to 1, the current cumulative flow is added to the positive cumulative flow.

[0136] When the baseline period flow code is equal to 2, the current cumulative flow is increased to the reverse cumulative flow.

[0137] Among them, based on the reference period and the periodic flow time difference sequence, the instantaneous flow corresponding to the current flow sampling period sequence is determined, including:

[0138] The element number of the reference period in the current flow sampling period sequence is obtained as the reference period number.

[0139] The fifth decision quantifier is determined by determining half the number of elements in the current flow sampling period sequence.

[0140] Determine whether the reference period number is greater than the fifth judgment quantity to obtain the seventh judgment result.

[0141] If the result of the seventh judgment is negative, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0.

[0142] If the result of the seventh judgment is yes, then determine whether the base period flow direction code is equal to 0, and obtain the result of the eighth judgment.

[0143] If the result of the eighth judgment is yes, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0.

[0144] If the result of the eighth judgment is negative, the number of elements with an index not equal to 3 in the periodic flow time difference sequence is obtained as the first quantity C.

[0145] Obtain the baseline element sequence from the periodic flow time difference sequence. All elements in the baseline element sequence are continuous in the periodic flow time difference sequence, and the index of all elements in the baseline element sequence in the periodic flow time difference sequence is equal to the baseline periodic flow direction code.

[0146] The sequence of elements with the largest number of elements is determined as the current reference element sequence.

[0147] The number of elements in the current baseline element sequence is determined as the second quantity G.

[0148] When the baseline periodic flow direction code equals 1, it is determined whether the first condition is met, resulting in the ninth judgment result. The first condition is G>1 and G>(K / 2). K is the number of elements in the periodic flow time difference sequence whose index equals the baseline periodic flow direction code.

[0149] If the result of the ninth judgment is yes, then the arithmetic mean of all elements in the current reference element sequence is the reference period flow time difference.

[0150] Based on the baseline periodic flow time difference and the flow time difference-instantaneous flow relationship, the instantaneous flow corresponding to the current flow sampling period sequence is determined. The flow time difference-instantaneous flow relationship is as follows: q is the instantaneous flow rate. Let be the flow time difference, c be the speed of sound in water, R be the radius of the water meter opening, and L be the ultrasonic path of the water meter.

[0151] If the result of the ninth judgment is negative, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0.

[0152] When the flow direction code in the reference period is equal to 2, it is judged whether the second condition is satisfied to obtain the tenth judgment result. The second condition is G > 1 and G > (C / 2).

[0153] If the tenth judgment result is yes, the arithmetic mean of all elements in the current reference element sequence is the reference period flow time difference.

[0154] Based on the reference period flow time difference and the flow time difference - instantaneous flow relationship, the instantaneous flow corresponding to the current flow sampling period sequence is determined.

[0155] If the tenth judgment result is no, it is determined that the instantaneous flow corresponding to the current flow sampling period sequence is 0.

[0156] In an exemplary embodiment, a two-way metering method applied to abnormal flow in pipeline network disturbances is provided, including:

[0157] S101: The microprocessor of the ultrasonic water meter is set with a flow sampling period T, a sampling number n, records the number m of positive flow time difference times and the number k of reverse flow time difference times in n sampling times within the sampling period T, and n ≥ (m + k).

[0158] S102: Calculate and judge the positive flow time difference m and the reverse flow time difference number k in multiple samplings n within the sampling period T.

[0159] S1021: If m ≥ k and (m - k) ≥ (n - 2), it is determined that the flow direction of the current sampling period T is positive, record the period flow direction code dir = 1, and the flow time difference data of this sampling indicating the average flow time difference of this sampling, t f is the arithmetic mean average time difference of m positive flow time differences in this sampling, otherwise it is determined that the direction of the current sampling period T is undetermined, record dir = 0, and the flow time difference data of this sampling

[0160] S1022: If m < k and (k - m) ≥ (n - 2), it is determined that the flow direction of the current sampling period T is reverse, record the period flow direction code dir = 2, and the flow time difference data of this sampling t r is the arithmetic mean of k reverse flow time differences in this sampling, otherwise it is determined that the direction of the current sampling period T is undetermined, record dir = 0, and the flow time difference data of this sampling

[0161] S1023: If (m+k)≤g, then the current sampling period T is determined to be an error in flow measurement (not meeting the minimum requirement for the number of samplings). The direction of the current sampling period T is also determined to be incorrect. Record dir=3 and the flow time difference data for this sampling.

[0162] Traffic time difference data Including the time of flight of the sound wave downstream T d The time of sound wave retrograde flight T u If during a single flow sampling process, T u ≥T d Therefore, the time difference of the flow rate in this sampling is determined to be positive Δt = T. u -T d Otherwise, the time difference of the current sampling flow is determined to be the reverse Δt = T. d -T u Record the flow rate time difference and direction (Δt1, d1), (Δt2, d2), and (Δt) during this sampling period T. i ,d i ), i≤n. The flow direction d for this sampling period T is determined according to method S102. R .

[0163] The time difference data of the i-th sampled flow rate within the current sampling period T is arranged according to the flow direction d. R The data is processed, such as the flow direction d in the i-th data. i With d R If the directions are different, then the flow time difference data Δt of the i-th sampling will be... i Eliminate, and finally satisfy d R The arithmetic mean of the flow time difference data in the same direction is used to obtain the flow time difference at the sampling period T.

[0164] S103: For M sampling periods T j (j≤M), collect traffic time difference data to obtain M periods of traffic time difference data. Simultaneously obtain M cycles of flow direction data d Rj The data is managed according to the queue method.

[0165] Based on the M sampling periods T of S103 j In the case of pipeline network disturbance and pressure imbalance, the flow direction data d for M cycles Rj The direction of flow is random, and it may be inconsistent within adjacent sampling periods. In the case of actual water usage by users, the flow direction data d over M periods... Rj Continuity should be satisfied.

[0166] S201: Locate and index the M queue data obtained from S103, with the most recent sampling indicating the flow direction, i.e., d. Rj =0,1,2, and the index value of the flow direction that was most recently sampled normally in the M queue data cannot exceed half of M, i.e., M / 2. If it exceeds this value, then the instantaneous flow q calculated in this instance is determined. t =0.

[0167] S202: Obtain the instantaneous flow rate q for this calculation according to the method in S201. t Flow direction d Rk Determine the flow direction for M sampling periods T, and determine the direction of d. Rj =d Rk The flow direction is counted and recorded, and the number is K. Meanwhile, the flow direction d of normal sampling is also counted. Rj Count the numbers = 0, 1, 2 and record the number as C.

[0168] S203: The instantaneous flow rate q obtained in this calculation according to the method in S201. t and flow direction d Rk If the flow direction is determined as having no definite direction, i.e., d Rk =0, then the instantaneous flow rate q is calculated in this case. t =0, otherwise, perform continuity d on the flow direction of M queue data. Rj =d Rk Calculate the statistics and record the number of consecutive occurrences as G.

[0169] S204: Instantaneous flow rate q calculated in this operation t G is obtained according to method S203, if d Rk =1, which should satisfy G>1 and G>(K / 2), then calculate the instantaneous flow rate q in this calculation. t The arithmetic mean of the flow time difference M sampling periods T consecutive time difference data G. The instantaneous flow rate q was calculated by using the relationship between the flow rate time difference and the instantaneous flow rate. t Otherwise, if the above conditions are not met, then q t =0.

[0170] If d Rk =2, which should satisfy G>1 and G>(C / 2), then calculate the instantaneous flow rate q in this calculation. t The arithmetic mean of the flow time difference M sampling periods T consecutive time difference data G. The instantaneous flow rate q was calculated by using the relationship between the flow rate time difference and the instantaneous flow rate. t Otherwise, if the above conditions are not met, then q t =0.

[0171] S205: q calculated according to method S204 t It should meet the system's limit on instantaneous flow, i.e., q. t ≥q s Then through the instantaneous flow rate q t The cumulative flow rate through the water meter is obtained by calculating the relationship between d and the cumulative flow rate Q. Rk If the value is 1, then the cumulative flow calculated this time will be added to the positive cumulative flow Q. F If d Rk If the value is 2, then the cumulative flow calculated this time will be added to the reverse cumulative flow Q. R .

[0172] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 2 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a bidirectional metering method applied to abnormal flow under pipeline disturbances.

[0173] Those skilled in the art will understand that Figure 2 The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0174] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0175] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0176] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0177] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0178] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

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

[0180] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A bidirectional metering method applied to abnormal flow rates under pipeline disturbances, characterized in that, include: Acquire sampling data from the ultrasonic water meter within the current flow sampling cycle sequence; Based on the sampled data, the cycle flow time difference and cycle flow direction code for each cycle corresponding to the current flow sampling cycle sequence are determined, including: determining any cycle within the current flow sampling cycle sequence as the current cycle; obtaining the total number of samplings n of the ultrasonic water meter within the current cycle; based on the sampled data, determining the sampling flow time difference and sampling flow direction for each sampling within the current cycle; the sampling flow direction includes forward and reverse; obtaining the number of times the sampling flow direction is forward within the current cycle as the forward flow time difference count m; obtaining the number of times the sampling flow direction is reverse within the current cycle as the reverse flow time difference count k; determining the cycle flow direction code for the current cycle based on the total number of samplings n, the forward flow time difference count m, and the reverse flow time difference count k; determining the cycle flow time difference for the current cycle based on the cycle flow direction code for the current cycle, and the sampling flow time difference and sampling flow direction for each sampling within the current cycle; updating the current cycle, and returning to the step "obtaining the total number of samplings n of the ultrasonic water meter within the current cycle" until the current flow sampling cycle sequence is traversed to obtain the cycle flow time difference and cycle flow direction code for each cycle corresponding to the current flow sampling cycle sequence; Using periodic flow direction codes as indexes, construct periodic flow time difference sequences in chronological order; Based on the periodic flow time difference sequence, the cumulative flow corresponding to the current flow sampling period sequence is determined.

2. The bidirectional metering method for abnormal flow under pipeline disturbances according to claim 1, characterized in that, Based on the sampled data, determine the sampling flow time difference and sampling direction for each sampling within the current period, including: Let the number of samples i = 1; The sampling data at the i-th sampling point is determined as the current sampling data; the current sampling data includes the downstream flight time of the sound wave at the i-th sampling point. and the time of flight of the sound wave during the i-th sampling. ; Determine the time of backflow of the sound wave at the i-th sample in the current sampled data. Is it greater than or equal to the downstream flight time of the sound wave at the i-th sampling time? The first judgment result is obtained; If the first judgment result is yes, then the sampling direction at the i-th sampling time is determined to be positive; Determine the sound wave retrograde flight time at the i-th sampling. Compared with the downstream flight time of the sound wave at the i-th sampling time The difference is the sampling flow time difference; If the first judgment result is negative, then the sampling flow direction during the i-th sampling is determined to be reversed; Determine the downstream flight time of the sound wave at the i-th sampling. Compared with the sound wave retrograde flight time at the i-th sampling time The difference is the sampling flow time difference; Determine whether the number of samples i has reached the total number of samples n in the current period, and obtain the second determination result; If the second judgment result is negative, then the value of the sampling number i is incremented by 1, and the process returns to the step "determine the sound wave retrograde flight time at the i-th sampling in the current sampled data". Is it greater than or equal to the downstream flight time of the sound wave at the i-th sampling time? "and thus the first judgment result was obtained"; If the second judgment result is yes, then the sampling flow time difference and sampling direction for each sampling in the current period are obtained.

3. The bidirectional metering method for abnormal flow under pipeline disturbances according to claim 1, characterized in that, Based on the total number of samplings n, the number of forward flow time differences m, and the number of reverse flow time differences k, the periodic flow direction code for the current period is determined, including: Obtain the threshold for the number of valid samples; The sum of the forward flow time difference count m and the reverse flow time difference count k is determined as the effective sampling count; Determine whether the number of valid samples has reached the threshold for the number of valid samples, and obtain a third determination result; If the third judgment result is negative, then set the cycle flow direction code of the current cycle to 3; a cycle flow direction code of 3 indicates that the current cycle flow measurement is incorrect. If the third judgment result is yes, then let the difference between the total number of samplings n and the preset amount be the second judgment amount; Determine whether the forward flow time difference count m is less than the reverse flow time difference count k to obtain the fourth determination result; If the fourth judgment result is negative, then the difference between the number of forward flow time difference m and the number of reverse flow time difference k is determined as the third judgment quantity; Determine whether the third decision value is less than the second decision value to obtain the fifth decision result; If the fifth judgment result is negative, then set the cycle flow direction code of the current cycle to 1; a cycle flow direction code of 1 indicates that the flow direction of the current cycle is positive. If the fifth judgment result is yes, then set the cycle flow direction code of the current cycle to 0; a cycle flow direction code of 0 indicates that the flow direction of the current cycle has no definite direction. If the fourth judgment result is yes, the difference between the number of reverse flow time difference k and the number of forward flow time difference m is determined as the fourth judgment quantity; Determine whether the fourth decision value is less than the second decision value to obtain the sixth decision result; If the result of the sixth judgment is negative, then set the cycle flow direction code of the current cycle to 2; the cycle flow direction code equal to 2 indicates that the flow direction of the current cycle is reversed. If the sixth judgment result is yes, then set the cycle flow code of the current cycle to 0.

4. The bidirectional metering method for abnormal flow under pipeline disturbances according to claim 3, characterized in that, Based on the cycle flow direction encoding of the current cycle, and the sampling flow time difference and sampling flow direction at each sampling time within the current cycle, the cycle flow time difference of the current cycle is determined, including: The effective sampling flow time difference is determined by identifying the time difference of all sampling flows within the current period that have the same sampling direction as the periodic flow direction. The arithmetic mean of all valid sampled flow time differences is determined as the periodic flow time difference for the current period.

5. The bidirectional metering method for abnormal flow under pipeline disturbances according to claim 3, characterized in that, Based on the periodic flow time difference sequence, the cumulative flow corresponding to the current flow sampling period sequence is determined, including: In chronological order, the first cycle whose flow direction code is not equal to 3 is obtained from back to front as the base cycle; The periodic flow direction code of the base period is determined as the base period flow direction code; Based on the reference period and the periodic flow time difference sequence, determine the instantaneous flow corresponding to the current flow sampling period sequence; The product of the instantaneous flow rate corresponding to the current flow sampling period sequence and the pipeline area is determined as the current cumulative flow rate; Obtain positive and negative cumulative traffic; When the baseline period flow direction code is equal to 1, the current cumulative flow is increased to the positive cumulative flow; When the baseline period flow code is equal to 2, the current cumulative flow is increased to the reverse cumulative flow.

6. The bidirectional metering method for abnormal flow under pipeline disturbances according to claim 5, characterized in that, Based on the reference period and the periodic flow time difference sequence, the instantaneous flow corresponding to the current flow sampling period sequence is determined, including: The element number of the reference period in the current flow sampling period sequence is obtained as the reference period number; The fifth determination factor is determined by setting half the number of elements in the current flow sampling period sequence. Determine whether the reference period number is greater than the fifth determination value to obtain the seventh determination result; If the seventh judgment result is negative, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0; If the seventh judgment result is yes, then the baseline period flow direction condition judgment is performed.

7. The bidirectional metering method for abnormal flow under pipeline disturbances according to claim 6, characterized in that, Determining the flow direction based on the baseline period includes: Determine if the baseline period flow direction code is equal to 0 to obtain the eighth determination result; If the eighth judgment result is yes, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0; If the eighth judgment result is negative, then the condition judgment of the continuous sequence length that needs to be satisfied when moving forward or backward is performed.

8. The bidirectional metering method for abnormal flow under pipeline disturbances according to claim 7, characterized in that, The conditions for determining the length of the continuous sequence that must be satisfied during forward / reverse execution include: The number of elements with an index not equal to 3 in the periodic flow time difference sequence is taken as the first quantity C; Obtain the reference element sequence in the periodic flow time difference sequence; all elements in the reference element sequence are continuous in the periodic flow time difference sequence, and the index of all elements in the reference element sequence in the periodic flow time difference sequence is equal to the reference periodic flow direction code; The current reference element sequence is determined by identifying the sequence with the most elements. The number of elements in the current baseline element sequence is determined as the second quantity. ; When the baseline periodic flow code is equal to 1, it is determined whether the first condition is met, resulting in the ninth judgment result; the first condition is... ,and ; The number of elements in the periodic flow time difference sequence whose index is equal to the base periodic flow direction code; If the ninth judgment result is yes, then the arithmetic mean of all elements in the current benchmark element sequence is the benchmark periodic flow time difference; Based on the baseline periodic flow time difference and the relationship between flow time difference and instantaneous flow, the instantaneous flow corresponding to the current flow sampling period sequence is determined; If the ninth judgment result is negative, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0; When the base cycle flow code equals 2, determine whether the second condition is met to obtain the tenth judgment result; the second condition is... ,and ; If the tenth judgment result is yes, then the arithmetic mean of all elements in the current benchmark element sequence is the benchmark periodic flow time difference; Based on the baseline periodic flow time difference and the relationship between flow time difference and instantaneous flow, the instantaneous flow corresponding to the current flow sampling period sequence is determined; If the tenth judgment result is negative, then the instantaneous flow corresponding to the current flow sampling period sequence is determined to be 0.

9. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the bidirectional metering method for abnormal flow under pipeline disturbances as described in any one of claims 1-8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the bidirectional metering method for abnormal flow under pipeline disturbances as described in any one of claims 1-8.