An ultrasonic water meter adaptive Kalman filtering method based on time difference of propagation
By using an adaptive Kalman filter method, the problems of metering accuracy and dynamic response of ultrasonic water meters in complex environments were solved, achieving high-precision and stable flow measurement.
Patent Information
- Application Number
- CN202611620955.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-20
- Publication Date
- 2026-11-27
AI Technical Summary
Existing ultrasonic water meters are susceptible to electromagnetic interference, temperature changes, and flow disturbances in flow measurement, resulting in random noise, outliers, and period jumps in the time difference measurement values. Furthermore, there is a lack of effective methods for handling anomalies and suppressing noise, which affects the metering accuracy and dynamic response performance.
An adaptive Kalman filter method based on propagation time difference is adopted. Through validity determination, integer period repair, static water zero bias compensation, extreme value removal moving average, dual-stage process noise variance control and one-dimensional Kalman filtering, abnormal data are processed in a coordinated manner to improve measurement accuracy and stability.
It effectively suppresses noise under complex operating conditions, tracks sudden changes in flow, eliminates anomalies, improves the metering accuracy and environmental adaptability of ultrasonic water meters, and achieves a balance between stability and response speed.
Smart Images

Figure CN123175382A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ultrasonic water meter technology, specifically an adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference. Background Technology
[0002] Ultrasonic water meters have advantages such as no moving mechanical parts, low pressure loss, high metering accuracy, and long service life, and have been widely used in the field of water supply metering. Most existing ultrasonic water meters use the time difference method for flow measurement. The basic principle is that ultrasonic transducers are installed in pairs on both sides of the pipe section to emit and receive ultrasonic signals respectively. By measuring the time difference between the downstream and upstream propagation time of the ultrasonic waves, the water flow velocity is calculated, and then the instantaneous flow rate and cumulative flow rate are obtained. Since the downstream and upstream propagation time difference is usually on the nanosecond level, the signal is weak and is easily affected by electromagnetic interference, temperature changes, flow disturbances, bubbles, impurities, transducer aging, and echo amplitude fluctuations, resulting in problems such as random noise, outliers, and period jumps in the time difference measurement value.
[0003] In related technologies, moving average filtering or Kalman filtering is commonly used to smooth the propagation time difference. However, traditional moving average filtering is sensitive to outliers. If impulse noise or periodic jumps are mixed into the measurement sequence, the reference mean is easily contaminated, thus affecting the accuracy of flow calculation. Traditional Kalman filtering typically uses fixed process noise variance Q and measurement noise variance R. When the process noise variance Q is set large, the filter response is fast, but the noise suppression capability is insufficient in steady state, easily causing fluctuations in flow readings. When the process noise variance Q is set small, the filtering effect is good in steady state, but the tracking lag is poor when the flow changes abruptly, resulting in poor dynamic response performance. Therefore, Kalman filtering with fixed process noise variance cannot simultaneously achieve both steady-state measurement accuracy and dynamic response speed.
[0004] Furthermore, ultrasonic water meters also have the following problems in actual operation: TOF measurement may fail due to unqualified amplitude, sensor errors, or interference; integer period jumps can cause large deviations in time difference; the inherent time difference of still water will drift with temperature changes; abnormal measurements, if involved in sliding window, range switching, or Kalman state updates, will contaminate subsequent filtering results. Existing technologies lack a systematic and coordinated solution for TOF validity determination, period offset repair, still water zero bias compensation, extreme value removal and sliding average, deviation discrimination, dual-range process noise control, one-dimensional Kalman filtering, and anomaly handling.
[0005] Therefore, there is an urgent need for an ultrasonic water meter filtering method that can adaptively adjust the process noise variance based on the propagation time difference deviation, while taking into account anomaly handling, periodic repair, zero bias compensation, and steady-state noise suppression. Summary of the Invention
[0006] (a) Technical problems to be solved This invention provides an adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference, aiming to solve the problems mentioned in the background art.
[0007] (II) Technical Solution To achieve the above objectives, the present invention provides the following technical solution: An adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference is proposed. The ultrasonic water meter includes a TDC sensor, an ultrasonic transducer, a TOF acquisition unit, and a processor executing the metering program. The method includes the following steps: S1. Measure the time difference between the forward and reverse propagation times of the ultrasonic transducer using a TDC sensor, and determine the validity of the current frame's TOF. After determining validity, perform integer period repair and static water zero-bias compensation to obtain the filtered input. ; S2. Calculate the extreme value reference mean based on the most recent 8 measurements, including this observation. and according to and Determine the normalization bias; S3. Based on the normalized deviation, the deviation is judged, and dual-level process noise variance Q control is performed to switch the process noise variance between the fast response level and the stable level. S4. Using a one-dimensional Kalman filter The prediction, gain calculation and posterior update are performed sequentially to obtain the filtered DTOF; S5. Determine the flow direction, process the temperature, and calculate the flow rate / flow rate based on the filtered DTOF. Specifically, the moving average, Q control, and DTOF Kalman state are updated only after the current frame passes the TOF validity determination; exception handling is performed when an anomaly occurs.
[0008] As a preferred technical solution of this application, the filtered input The current DTOF after periodic repair and deduction of static zero bias, in units of ; The observation time difference after compensating for the inherent time difference of still water in step S1 is: in, , These are the trusted downstream propagation time and the trusted upstream propagation time, respectively. This is due to the inherent time difference of still water.
[0009] As a preferred technical solution of this application, in step S2, the extreme value reference mean is calculated using up to 8 measurement values, including the current observation. And calculate the absolute deviation. and normalization bias : ; when hour, ; when hour, ; Where h is the deviation threshold and ε is the bias term.
[0010] As a preferred technical solution of this application, the... , .
[0011] As a preferred technical solution of this application, in step S3, when two consecutive occurrences... When there is a significant deviation, switch to fast response mode; When no significant deviation is observed for 8 consecutive tests, resume the stable mode; process noise variance in the fast response mode. Process noise variance greater than the steady range .
[0012] As a preferred technical solution of this application The .
[0013] As a preferred technical solution of this application, the one-dimensional Kalman filtering in step S4 includes: ; ; ; ; in, For prior time difference estimation, For posterior time difference estimation, To estimate the variance of the prior error, To estimate the variance of the error in the posterior time interval, For Kalman gain, R represents the process noise variance corresponding to the current gear, and R represents the measurement noise variance.
[0014] As a preferred technical solution of this application, the anomaly handling includes: when the amplitude is unqualified or the sensor reports an error, no measurement is performed and the instantaneous flow rate is set to zero; when the cycle repair fails, the most recent qualified result or the previous result is maintained; the sliding window, gear or filter status is not updated for any of the above anomalies.
[0015] As a preferred technical solution of this application, the ultrasonic transducers are installed in pairs on both sides of the pipe section and symmetrically distributed at both ends of the ultrasonic transmission channel reserved in the bracket, respectively for transmitting and receiving ultrasonic signals; the TDC sensor is electrically connected to the ultrasonic transducers and is fixedly installed inside the meter body shell, used to measure the time difference of ultrasonic forward and reverse propagation and transmit the time difference signal to the processor; the ultrasonic water meter also includes three reflectors, of which two reflectors are installed on the opposite side of the transducers and one reflector is installed on the same side of the transducers and located in the middle of the two transducers. The two transducers and the three reflectors form a W-shaped structure, and the ultrasonic wave completes one propagation along the W-shape in the water.
[0016] (III) Beneficial Effects By working in sequence and in concert through the following steps: validity determination, periodic offset repair, static water zero bias compensation, extreme value removal and sliding average, deviation discrimination, dual-level Q control, one-dimensional Kalman filtering and flow calculation, the ultrasonic water meter can suppress noise, track sudden changes and eliminate anomalies under complex working conditions, thereby improving the metering accuracy, stability and environmental adaptability of the ultrasonic water meter. In the metering process of ultrasonic water meters, the propagation time difference after measurement quality inspection and static water compensation is used as input. The normalized deviation is constructed by using the average of the last 8 measurements after removing extreme values to judge the degree of deviation. Then, based on the number of consecutive deviations and consecutive falls, the meter switches between the stable range and the fast response range. First, unreliable measurements are identified, full-cycle jumps are corrected, and the inherent time difference of still water is subtracted. Then, the degree of deviation is assessed and the Kalman filter is updated. Finally, the flow rate is calculated using the filtered results. The response level is coordinated with the reliability assessment, result retention, and reference re-establishment to prevent abnormal results from changing the filter status. Using a one-dimensional Kalman filter, the state variables and calculation process are simple, requiring only prediction, gain calculation, and posterior update. It is suitable for real-time operation in the processor of ultrasonic water meters, without the need for complex models or large amounts of computing resources. Attached Figure Description
[0017] Figure 1 This is a flowchart of an adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference; Figure 2 This is a comparative data chart of water meter noise variance test results for this invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] like Figure 1 As shown, this invention provides an adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference, applied to ultrasonic water meters. The ultrasonic water meter includes a TDC sensor, an ultrasonic transducer, a TOF acquisition unit, and a processor executing the metering program. The method includes the following steps: S1. Measure the time difference between the forward and reverse propagation times of the ultrasonic transducer using a TDC sensor, and determine the validity of the current frame's TOF. After determining validity, perform integer period repair and static water zero-bias compensation to obtain the filtered input. ; S2. Calculate the extreme value reference mean based on the most recent 8 measurements, including this observation. and according to and Determine the normalization bias; S3. Based on the normalized deviation, the deviation is judged, and dual-level process noise variance Q control is performed to switch the process noise variance between the fast response level and the stable level. S4. Using a one-dimensional Kalman filter The prediction, gain calculation and posterior update are performed sequentially to obtain the filtered DTOF; S5. Determine the flow direction, process the temperature, and calculate the flow rate / flow rate based on the filtered DTOF. Specifically, the moving average, Q control, and DTOF Kalman state are updated only after the current frame passes the TOF validity determination; exception handling is performed when an anomaly occurs.
[0020] Example 1 The ultrasonic water meter includes a meter body, pipe section, support, TDC sensor, ultrasonic transducer, TOF acquisition unit, processor, temperature sensor, storage unit, display unit, and communication unit. The processor is equipped with a metering program, which sequentially includes functions for validity determination, period offset repair, static water zero offset compensation, extreme value removal and moving average, deviation discrimination, dual-level Q control, one-dimensional Kalman filtering, and flow calculation.
[0021] Ultrasonic transducers are installed in pairs on both sides of the pipe section, symmetrically distributed at both ends of the ultrasonic transmission channel reserved in the support. They are used to transmit and receive ultrasonic signals, respectively. The TDC sensor is electrically connected to the ultrasonic transducers and is fixedly installed inside the casing. It is used to accurately measure the time difference between the forward and reverse propagation times of the ultrasonic waves and transmits the time difference signal to the processor. The TDC sensor adopts a high-precision design and has anti-interference capabilities, effectively reducing the impact of external electromagnetic interference on the time difference measurement.
[0022] In this embodiment, the ultrasonic water meter also includes three reflectors. Two reflectors are installed on opposite sides of the transducer, and one reflector is installed on the same side of the transducer and located between the two transducers. The two transducers and the three reflectors form a "W" shape, and the ultrasonic wave completes one propagation along the "W" shape in the water. This structure extends the ultrasonic wave propagation path and improves the resolution of time difference measurement.
[0023] The TOF acquisition unit is used to acquire the forward and reverse propagation times of ultrasonic waves and send the acquisition results to the processor. The processor performs validity determination, period offset repair, static water zero bias compensation, extreme value removal and moving average, deviation discrimination, dual-level Q control, one-dimensional Kalman filtering and flow calculation based on the output of the TOF acquisition unit.
[0024] Example 2 In this embodiment, the filtered input zk is the current DTOF after periodic repair and subtraction of static water zero bias, in ns. The moving average, Q control, and DTOF Kalman state are updated only after the current frame passes the TOF validity determination; the filtered DTOF is then used for flow direction determination, temperature processing, and flow rate / volume calculation.
[0025] Specifically, the measurement reliability assessment and integer period correction are completed first, followed by compensation for the inherent stillness time difference. The observation time difference after compensating for the inherent stillness time difference is: in, , These are the reliable downstream propagation time and the reliable upstream propagation time, respectively. The inherent time difference of still water; The current temperature; To compensate for the time difference after observation.
[0026] In one implementation, the validity determination includes: checking whether the TDC sensor reports an error, whether the echo amplitude is within a preset range, whether the signal-to-noise ratio is greater than a preset threshold, and whether the propagation time in the upstream and downstream directions is within a physically reasonable range. If any condition is not met, the current frame TOF is determined to be invalid, no measurement is performed, the instantaneous flow is set to zero, and the sliding window, gear, or filtering status is not updated.
[0027] Period offset repair involves comparing the current Time-of-Flight (TOF) with the previous acceptable TOF. If the deviation is close to an integer number of ultrasound cycles, the corresponding integer number of cycles is added or subtracted to bring the TOF within a reasonable range. If the deviation still exceeds the reasonable range after repair, the period repair is deemed a failure, and the most recent acceptable result or the previous result is retained without updating the sliding window, speed setting, or filter status.
[0028] Static water zero bias compensation includes: calibrating the inherent travel time of static water at different temperatures under zero flow conditions. It is stored as a temperature-zero offset lookup table, and during actual operation, it is adjusted according to the current temperature. Interpolation obtained And deduct it from the time difference.
[0029] Example 3: Calculation of Moving Average and Deviation after Removing Extreme Values In this embodiment, the extreme value reference mean is calculated using up to eight measurements, including this observation. ; Specifically, a sliding window of length 8 is maintained. Each valid observation is enqueued. If the window is full, the oldest data is removed. When calculating the reference mean, the maximum and minimum values within the window are removed first, and then the average of the remaining data is calculated to obtain the reference mean. If there are fewer than 8 valid observations, the current actual number will be used for calculation.
[0030] Then, the normalized bias is calculated, and the absolute bias ak is: ; when hour, ; when hour, ; Where h is the deviation threshold and ε is the bias term. In this embodiment, h = 1 ns and ε = 0.04 ns. The deviation ratio is used to characterize the degree of deviation of the current observation from the reference mean.
[0031] In another implementation, the median value can be used instead of the mean value after removing extreme values, or an average value can be calculated after removing extreme values that exceed a set range, as long as the influence of impulse noise on the reference mean can be suppressed.
[0032] Example 4: Dual-gear Q control In this embodiment, deviation is determined based on the normalized deviation, and dual-level process noise variance Q control is performed to switch the process noise variance between the fast response level and the stable level.
[0033] Specifically, the gear position state variable is set. Initially, it is in a stable gear, and the process noise variance is... After each valid observation, determine whether a significant deviation has occurred. A significant deviation is recorded when two consecutive significant deviations occur. If two significant deviations occur consecutively, the system switches to fast response mode, and the process noise variance is adjusted accordingly. In the fast response mode, if no significant deviation occurs for 8 consecutive times, the system will revert to the stable mode, and the process noise variance will switch back. .
[0034] In this embodiment, = 0.00004ns 2 , =0.004ns 2 The process noise variance in the fast response mode is greater than that in the steady mode, thereby improving the response speed of the Kalman filter when the flow rate changes abruptly or dynamically; a smaller process noise variance is used in the steady state to suppress noise and improve metering stability.
[0035] Optionally, two counters can be set: an offset counter and a recovery counter, when When the offset counter increments by 1, the recovery counter is reset to zero; when When the recovery counter reaches 2, the system switches to the fast response mode; when the recovery counter reaches 8, the system switches to the stable mode.
[0036] Example 5: One-dimensional Kalman Filtering In this embodiment, a one-dimensional Kalman filter is used. Prediction, gain calculation, and posterior update are performed sequentially to obtain the filtered DTOF.
[0037] The state variable of the Kalman filter is the time difference estimate x, and the process model is: in, For prior time difference estimation, This is an estimate of the posterior time difference from the previous time step. To estimate the variance of the prior error, The variance of the posterior estimation error at the previous time step. This represents the process noise variance corresponding to the current gear.
[0038] Calculate the Kalman gain: in, R is the Kalman gain, and R is the measurement noise variance. R can be pre-calibrated according to the TDC measurement accuracy. In this embodiment, R is taken as 0.01 ns. 2 However, the present invention is not limited thereto.
[0039] Post-hoc update: in, This is for posterior time difference estimation, i.e., filtered DTOF; This represents the variance of the posterior estimation error.
[0040] During initialization, we can set x0|0 = 0 ns and P0|0 = 1 ns. 2 , Select based on the current gear: In stable gear = Fast response time = .
[0041] Using the aforementioned one-dimensional Kalman filter, real-time smoothing and tracking of DTOF can be achieved without establishing a complex state-space model. When the process noise variance switches to... When the filter gain increases, it can track sudden changes in flow more quickly; when switching to When the filter gain decreases, it can effectively suppress random noise.
[0042] Example 6: Flow Calculation and Anomaly Handling The filtered DTOF then supplies flow direction determination, temperature processing, and flow rate / volume calculation. Flow direction determination can be based on... and The size relationship is determined when: Less than When, it is determined to be a positive flow; when Greater than When the flow rate is reversed, it is determined to be reverse flow. Temperature processing compensates for sound velocity, pipe diameter, and zero bias based on the temperature sensor output. Flow velocity and flow rate can be calculated using well-known ultrasonic flow rate calculation formulas. For example, the instantaneous flow velocity can be calculated based on the propagation time difference between forward and reverse flow, propagation path length, sound channel angle, and pipe cross-sectional area. Then, the instantaneous flow rate is obtained by multiplying it by the pipe cross-sectional area and integrating over time to obtain the cumulative flow rate.
[0043] Anomaly handling includes: when the amplitude is unqualified or the sensor reports an error, no measurement is performed this time, and the instantaneous flow rate is set to zero; when cycle repair fails, the most recent qualified result or the previous result is retained; the sliding window, gear, or filter status is not updated for any of the above anomalies. Optionally, the processor can output a fault flag or alarm signal to prompt maintenance.
[0044] In this embodiment, the reliability of the measurement is determined as follows: The TDC chip measures the propagation time in both upstream and downstream directions during each sampling, and simultaneously reads the echo signal amplitude and first-wave pulse width ratio in both directions. The echo signal amplitude is the peak voltage of the ultrasonic received electrical signal relative to the reference level. The first-wave trigger pulse width is the time interval from when the received waveform identified as the first wave rises above the first-wave detection threshold to when it falls below that threshold. The reference pulse width is the time interval between the two zero-crossing points corresponding to the measured initial wave. The first-wave pulse width ratio is expressed as: Where j represents the direction of propagation, u represents downstream, and d represents upstream; The pulse width ratio of the first wave in this direction is dimensionless. The width of the first trigger pulse. For reference pulse width, both widths use the same time unit.
[0045] make and These represent the amplitudes of the downstream and upstream echo signals, respectively, in mV. When the sensor reports no errors, the amplitude is considered acceptable under the following conditions: If the sensor reports an error or the amplitude is unqualified, no measurement will be taken this time, and the instantaneous flow rate will be set to zero. After the amplitude is qualified, check the first pulse width ratio. The qualified conditions are: If the pulse width ratio of the first wave is not up to standard, attempt to repair the period jump; if it is up to standard, still check whether there is a period jump in the propagation time according to Part 2.
[0046] Identify and repair whole-cycle jumps: The change in the original propagation time relative to the most recent credible propagation time is: in, This refers to the original transmission time. This is the most recent reliable propagation time in this direction. The values represent the changes in both, both in nanoseconds (ns). If the initial pulse width ratio is acceptable and the following conditions are met simultaneously, the original propagation time will be used directly; otherwise, repair will be performed: Take the changes from the most recent 10 most reliable measurements in that direction to form a set. The predicted propagation time, number of repair cycles, and post-repair propagation time are as follows: in, For the predicted transmission time, The propagation time after repair is expressed in nanoseconds (ns). This is the set of recent reliable changes. This represents the number of samples in the set; median(·) is used for median calculation. This represents the number of repair cycles with a positive or negative sign; round(·) is the rounding operation. This refers to the time corresponding to one ultrasound cycle.
[0047] Define the repair residual and check all of the following conditions: in, This represents the difference between the corrected propagation time and the predicted propagation time in that direction, expressed in nanoseconds (ns). The symbol ∨ represents a logical "OR". A successful repair is determined only if all conditions are met. Indicates the trusted propagation time approved for this use: (normal time) When the repair is successful, retrieve If the repair fails, the current filter update will not be performed.
[0048] Obtain and compensate for the inherent time difference of still water: The water meter undergoes static water calibration during the production phase to maintain a still water flow, and the filter is fixed at the steady setting. The inherent time difference during static water flow and the observation time difference after compensation during operation are expressed as follows: in, Temperature calibration for still water, The temperatures used in this study are in the same unit; b( ) represents the static inherent time difference stored at this calibration temperature, b( ( ) represents the static water inherent time difference used at this temperature; During the static water calibration period The time difference after filtering The number of samples participating in the averaging is fixed at 80. k is the update sequence number for the reliable filter. To compensate for the observation time difference fed into the filter; the units for b, y, and z are all in nanoseconds.
[0049] Calculate recent reference values and determine the degree of deviation: Write the time difference of this reliable observation into a sliding window that can hold up to 8 measurements. The window contains this measurement. This indicates the current window. This represents the number of samples in the window; the window sum and reference mean are: in, This represents the sum of observation time differences within the window. For reference average, and , representing the maximum and minimum values within the window, respectively, both in nanoseconds; i is the reliable update sequence number corresponding to the observation within the window. Even if there are multiple identical samples for the maximum or minimum value, one sample from each is removed. This is a dimensionless count.
[0050] The absolute bias and normalized bias for this test are as follows: in, This is the absolute deviation, in nanoseconds (ns). This represents the dimensionless normalized bias, not the result of Gaussian distribution fitting; h is the bias neglect threshold, ε is a calculation constant in the denominator, in ns; γ is the dimensionless bias proportionality threshold. Only when... A deviation that is strictly greater than γ is considered a significant deviation.
[0051] Adjusting the response level and updating the Kalman filter includes the following: Response level and process noise: Start with a steady gear. This indicates the gear position: 0 for smooth gear and 1 for fast response gear. and The variances of the process noise at the two speeds are represented respectively: in, Here, R represents the process noise variance used in this study, and R represents the fixed measurement noise variance. Both units are in nanoseconds (ns). 2 Reliable measurement When the value is greater than γ twice consecutively, the gear shifts to fast response mode; in fast response mode, whenever... If the value is greater than γ, the count is reset to zero and continues to fall back. Only after eight consecutive tests with a value not exceeding γ should the system return to the stable setting. The stable setting should be used throughout the static water calibration process.
[0052] It also includes state and observation models: Using a one-dimensional constant state model, without setting external control input, and with both the state transition coefficient F and the observation coefficient H set to 1, the state equation and observation equation are as follows: in, The actual propagation time difference to be estimated. This is the time difference for this observation. This is the perturbation from the previous filtering step to the current filtering step. The disturbances in this measurement are in nanoseconds (ns); F and H are dimensionless coefficients. The model approximates the two disturbances as zero-mean, uncorrelated white noise, and assumes they are uncorrelated with the initial estimation error. Where E[·] is the expected value and Var(·) is the variance. Each reliable measurement first determines the current... Then execute the following predictions and updates.
[0053] Initialization and prediction equations: in, and These are the initial time difference estimate and the initial estimation error variance, respectively; This is the initial gear position. This represents the initial process noise variance. For this prior time difference estimation, This is the estimate of the previous posterior time difference, in nanoseconds (ns). This is the variance of the prior estimate error. This represents the variance of the previous posterior estimation error, in nanoseconds (ns). 2 The subscript "k|k-1" indicates that the current state is predicted based on previous observations.
[0054] Innovation and Kalman Gain: in, The new information is the difference between the current observation and the prior estimate, expressed in nanoseconds (ns). The variance of the innovation is expressed in nanoseconds (ns). 2 ; This is the dimensionless Kalman gain.
[0055] State and error variance update: in, This is the posterior time difference estimate after adding observations, i.e., the filtered time difference, in ns; This represents the variance of the posterior estimation error, in nanoseconds (ns). 2 The subscript "k|k" indicates that the update has been completed using this observation, and both are saved for use in the next reliable measurement; the filtered time difference is used for subsequent flow direction determination and flow velocity and flow rate calculation.
[0056] In this embodiment, the theoretical calculations of instantaneous flow velocity and cumulative water volume are as follows: The reliable propagation time difference obtained after filtering is used for subsequent flow velocity conversion. The instantaneous volumetric flow rate is then calculated from the flow velocity, and the cumulative water volume is obtained by integrating the flow rate over time.
[0057] Including instantaneous flow rate: Based on the difference in propagation time between upstream and downstream currents, the theoretical relationship of instantaneous flow velocity is as follows: in, denoted as , where is the instantaneous axial velocity at time t, in m / s; L is the acoustic path length of the ultrasonic wave in the water, in m; θ is the angle between the acoustic path and the positive direction of the tube axis, with cosθ being greater than zero. , These represent the downstream and upstream propagation times in water at the same measurement moment, respectively, in seconds (s). The time difference in the formula follows the convention of subtracting the downstream time from the upstream time; when converting flow velocity using the post-filtration time difference, the same sign convention should be maintained, and ns should be uniformly converted to s.
[0058] Instantaneous volumetric flow rate: Under the above ideal uniform flow velocity conditions, the instantaneous volumetric flow rate is equal to the product of the effective flow area of the pipe and the instantaneous flow velocity: Where q(t) is the instantaneous volumetric flow rate, in cubic meters per second (m³). 3 / s; A is the effective flow cross-sectional area, in m². 2 D is the effective inner diameter of the circular flow channel, in meters; π is the mathematical constant pi.
[0059] Total water volume: Integrating the instantaneous volumetric flow rate over time from the initial moment to the current moment yields the cumulative water volume: Where V(t) is the cumulative water volume at time t, V( The total water volume at the start time is expressed in cubic meters (m³). 3 ; Let t be the starting time of integration, t be the current time, and τ be the integration time variable, all in seconds. When accumulating from zero, the initial accumulated water volume is set to zero.
[0060] This embodiment provides actual test data for the water meter: Figure 2 The data shows the time difference from still water to a flow rate of 2500 L / h for 54 seconds before stopping. Comparing the time required to reach 90% of the change amplitude, adaptive Q-tracking is significantly faster.
[0061] In the initial stage, abnormal data with skipped cycles appeared. The yellow curve identified and repaired the cycle skipping without affecting the filtered data. The blue curve did not identify and repair the cycle skipping, and the filtered data also showed abnormal fluctuations.
[0062] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. An adaptive Kalman filtering method for ultrasonic water meters based on time-of-flight (TOF) propagation, applied to ultrasonic water meters, wherein the ultrasonic water meter includes a TDC sensor, an ultrasonic transducer, a TOF acquisition unit, and a processor executing a metering program, characterized in that, The method includes the following steps: S1. Measure the time difference between the forward and reverse propagation times of the ultrasonic transducer using a TDC sensor, and determine the validity of the current frame's TOF. After determining validity, perform integer period repair and static water zero-bias compensation to obtain the filtered input. ; S2. Calculate the extreme value reference mean based on the most recent 8 measurements, including this observation. and according to and Determine the normalization bias; S3. Based on the normalized deviation, the deviation is judged, and dual-level process noise variance Q control is performed to switch the process noise variance between the fast response level and the stable level. S4. Using a one-dimensional Kalman filter The prediction, gain calculation and posterior update are performed sequentially to obtain the filtered DTOF; S5. Determine the flow direction, process the temperature, and calculate the flow rate / flow rate based on the filtered DTOF. Specifically, the moving average, Q control, and DTOF Kalman state are updated only after the current frame passes the TOF validity determination; exception handling is performed when an anomaly occurs.
2. The adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference according to claim 1, characterized in that: The filtered input The current DTOF after periodic repair and deduction of static zero bias, in units of ; The observation time difference after compensating for the inherent time difference of still water in step S1 is: in, , These are the trusted downstream propagation time and the trusted upstream propagation time, respectively. This is due to the inherent time difference of still water.
3. The adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference according to claim 1, characterized in that: In step S2, the extreme value reference mean is calculated using up to eight measurements, including this observation. And calculate the absolute deviation. and normalization bias : ; when hour, ; when hour, ; Where h is the deviation threshold and ε is the bias term.
4. The adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference according to claim 3, characterized in that: The , .
5. The adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference according to claim 1, characterized in that: In step S3, when it occurs twice consecutively When there is a significant deviation, switch to fast response mode; After eight consecutive tests without significant deviation, return to a stable gear. Fast response profile process noise variance Process noise variance greater than the steady range .
6. The adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference according to claim 5, characterized in that: The .
7. The adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference according to claim 1, characterized in that: The one-dimensional Kalman filtering in step S4 includes: ; ; ; ; in, For prior time difference estimation, For posterior time difference estimation, To estimate the variance of the prior error, To estimate the variance of the error in the posterior time interval, For Kalman gain, R represents the process noise variance corresponding to the current gear, and R represents the measurement noise variance.
8. The adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference according to claim 1, characterized in that, The anomaly handling includes: when the amplitude is unqualified or the sensor reports an error, no measurement is performed and the instantaneous flow rate is set to zero; when the cycle repair fails, the most recent qualified result or the previous result is maintained; the sliding window, gear, or filter status is not updated for any of the above anomalies.
9. The adaptive Kalman filtering method for ultrasonic water meters based on propagation time difference according to claim 1, characterized in that, The ultrasonic transducers are installed in pairs on both sides of the pipe section and symmetrically distributed at both ends of the ultrasonic transmission channel reserved in the bracket, respectively for transmitting and receiving ultrasonic signals; the TDC sensor is electrically connected to the ultrasonic transducer and is fixedly installed inside the meter body shell, used to measure the time difference of ultrasonic forward and reverse propagation and transmit the time difference signal to the processor; the ultrasonic water meter also includes three reflectors, two of which are installed on the opposite side of the transducer and one is installed on the same side of the transducer and located in the middle of the two transducers. The two transducers and the three reflectors form a W-shaped structure, and the ultrasonic wave completes one propagation in the water along the W-shape.
