Error self-correction method suitable for ultrasonic gas meter
Patent Information
- Application Number
- CN202611186421.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-06
- Publication Date
- 2026-10-16
AI Technical Summary
[0003]然而,在超声燃气表计量模组使用计时芯片时,严重依赖接收信号质量,在高低温环境下,换能器频率偏移严重,接收波形畸形,信噪比下降,使计时芯片无法正确判断信号到达时刻,且产生较大的零点漂移,进而计算流量出错
[0015] The technical solution of this invention improves the reliability and accuracy of the received signal by setting the physical model of the received signal to a Gaussian mixture model. By setting the relationship between the temperature values collected in adjacent cycles and a first preset temperature value to a first preset relationship, the ultrasonic gas meter is controlled to enter a real-time compensation mode. In this mode, the model fitting parameters, upstream absolute time-of-flight compensation value, downstream absolute time-of-flight compensation value, and time difference compensation value of the physical model are calculated. This ensures that the values of each parameter in the physical model are temperature-dependent, reducing the impact of temperature on the received signal and further improving its reliability and accuracy. Furthermore, it provides a self-correcting compensation value update strategy, allowing the ultrasonic gas meter to self-correct errors based on temperature. Moreover, by setting the real-time compensation mode and calculating the instantaneous flow rate based on the compensated data, the metering reliability and accuracy of the instantaneous flow rate across the entire range can be improved.
Smart Images

Figure CN122921297A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ultrasonic flow measurement technology, and in particular to an error self-correction method suitable for ultrasonic gas meters. Background Technology
[0002] Due to their advantages such as high metering accuracy, wide range, and low pressure loss, ultrasonic gas meters are widely used in residential, industrial, and commercial fields. Their metering modules calculate flow velocity by measuring the propagation time difference of ultrasonic signals received by upstream and downstream transducers. Traditional ultrasonic gas meter metering modules typically use a dedicated timing chip. The main control chip of the ultrasonic gas meter sends a trigger signal to the timing chip, and then receives the arrival time of the signal returned by the timing chip (upstream and downstream absolute flight times). The time difference is obtained by subtracting the upstream and downstream absolute flight times, and then the instantaneous flow rate or velocity is calculated.
[0003] However, when using timing chips in ultrasonic gas meter modules, the system heavily relies on the quality of the received signal. In high and low temperature environments, the transducer frequency shifts significantly, resulting in distorted received waveforms and a decreased signal-to-noise ratio. This prevents the timing chip from accurately determining the signal arrival time and causes substantial zero-point drift, leading to errors in flow rate calculation. In real-world applications, the complex composition of pipeline gases and poor transducer manufacturing consistency further exacerbate the flow rate calculation errors inherent in traditional solutions. Furthermore, the metering modules for ultrasonic gas meters are imported; there are no reliable dedicated chips or domestically developed module products available domestically. This makes traditional solutions prone to flow rate calculation errors in practical applications, resulting in low reliability and accuracy of ultrasonic gas meter measurements. Summary of the Invention
[0004] This invention provides an error self-correction method for ultrasonic gas meters to improve the metering reliability and accuracy of ultrasonic gas meters.
[0005] This invention provides an error self-correction method suitable for ultrasonic gas meters, characterized by comprising: Based on the pre-defined order of the Gaussian mixture model, the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient, a physical model of the received signal is established. The upstream ultrasonic signal received by the first transducer and the downstream ultrasonic signal received by the second transducer are collected respectively. The upstream ultrasonic signal and the downstream ultrasonic signal are preprocessed to obtain the original waveform of the upstream signal and the original waveform of the downstream signal. The original envelope of the upstream signal corresponding to the original waveform of the upstream signal and the original envelope of the downstream signal corresponding to the original waveform of the downstream signal are extracted. The temperature value output by the temperature sensor is collected, and when the relationship between the temperature value collected in adjacent cycles and the first preset temperature value is the first preset relationship, the ultrasonic gas meter is controlled to enter the real-time compensation mode. In the real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is preprocessed to obtain the model fitting parameters of the physical model; wherein, the model fitting parameters include the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient. Based on the original waveform of the upstream signal, the original waveform of the downstream signal, the reference waveform of the upstream signal, and the reference waveform of the downstream signal, calculate the upstream absolute flight time, the upstream absolute flight time compensation value, the downstream absolute flight time, the downstream absolute flight time compensation value, the time difference, and the time difference compensation value. The instantaneous flow rate is calculated based on the compensated upstream absolute flight time, the compensated downstream absolute flight time, and the compensated time difference.
[0006] Optionally, the relationship between the temperature values collected in adjacent cycles and the first preset temperature value is determined by a process that includes: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both greater than the first preset temperature value, and the temperature value collected in the current cycle is greater than the sum of the temperature value collected in the previous cycle and the second preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the first preset relationship.
[0007] Optionally, in the real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is preprocessed to obtain the model fitting parameters of the physical model, including: In the real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is normalized to obtain a normalized envelope, and the signal slope is calculated based on the normalized envelope and preset feature points; wherein, the preset feature points are the corresponding positions and abscissas of the maximum values of the normalized envelope, namely 20%, 50%, and 100% of the maximum value. Calculate the model fitting parameters of the physical model based on the signal slope and the temperature value; Based on the signal slope and the temperature value, the model fitting parameters of the physical model are calculated, including: Find a point that is adjacent to the signal slope and is less than or equal to the signal slope, and a point that is adjacent to the signal slope and is greater than or equal to the signal slope; If the difference between the temperature values corresponding to two points is less than or equal to the second preset temperature value, the model fitting parameters of the physical model are calculated by linear interpolation. If the difference between the temperature values corresponding to two points is greater than the second preset temperature value, the model fitting parameters of the physical model are calculated by a preset algorithm; wherein, the preset algorithm includes least squares method, gradient descent method, genetic algorithm or differential evolution algorithm.
[0008] Optionally, after calculating the model fitting parameters of the physical model, the process includes: The reference envelope is calculated based on the model fitting parameters; wherein the reference includes the upstream signal reference envelope and the downstream signal reference envelope; Based on the correlation coefficient between the original envelope and the reference envelope, the signal slope of the reference envelope, the signal slope of the normalized envelope, and the preset weight adjustment coefficient, a matching degree calculation model for characterizing the goodness of fit is established; wherein, the original envelope includes the upstream signal original envelope and the downstream signal original envelope; The matching degree between the original envelope and the reference envelope is calculated based on the matching degree calculation model, and the order of the Gaussian mixture model is adjusted according to the matching degree.
[0009] Optionally, adjusting the order of the Gaussian mixture model based on the matching degree includes: When the matching degree is within the first confidence interval, the order of the current Gaussian mixture model is maintained; When the matching degree is in the second confidence interval, the order of the Gaussian mixture model is increased. When the matching degree is in the third confidence interval, the model fitting parameters are determined to be incorrectly fitted; wherein, the lower limit of the first confidence interval is greater than the upper limit of the second confidence interval, and the upper limit of the third confidence interval is less than the lower limit of the second confidence interval.
[0010] Optionally, the process of acquiring the reference waveform includes: Calculate the reference waveform when the phase parameter is zero based on the reference envelope and the physical model; The reference waveform includes the upstream signal reference waveform and the downstream signal reference waveform.
[0011] Optionally, the process of obtaining the upstream absolute time of flight includes: The upstream absolute flight time is calculated based on the upstream signal reference waveform using a threshold method. The process of obtaining the upstream absolute flight time compensation value includes: Cross-correlation is performed on the original waveform of the upstream signal and the reference waveform of the upstream signal to calculate the upstream absolute time-of-flight compensation value; The process of obtaining the downstream absolute flight time includes: The downstream absolute flight time is calculated based on the downstream signal reference waveform using a threshold method. The process of obtaining the downstream absolute flight time compensation value includes: Cross-correlation is performed on the original waveform of the downstream signal and the reference waveform of the downstream signal to calculate the absolute time-of-flight compensation value of the downstream signal. The process of obtaining the time difference includes: The time difference is calculated by cross-correlation of the original waveforms of the upstream signal and the original waveforms of the downstream signal. The process of obtaining the time difference compensation value includes: The time difference compensation value is calculated by cross-correlating the upstream signal reference waveform and the downstream signal reference waveform.
[0012] Optionally, the statistical characteristic parameters include: the mean μ of the k-th order Gaussian component. k and variance ; The calculation formula for the physical model is as follows: ; Among them, [A,α k ,μ k ,σ k [f, φ] represents the model fitting parameters, and k is the order of the Gaussian mixture model, k = 1, 2, ..., K. Let μ be the variance of the k-th order Gaussian distribution. k Let α be the mean. k Here, f is the weighting factor, and f is the transducer center operating frequency. Let t be the phase and t be the sampling time.
[0013] Optionally, the error self-correction method for ultrasonic gas meters further includes: When the relationship between the temperature value collected in an adjacent cycle and the first preset temperature value is the second preset relationship, the ultrasonic gas meter is controlled to enter the error self-correction mode. In the error self-correction mode, the instantaneous flow rate is calculated by inputting the saved upstream absolute flight time compensation value, downstream absolute flight time compensation value, and time compensation value; The process of determining the relationship between the temperature values collected in adjacent cycles and the first preset temperature value as a second preset relationship includes: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both greater than the first preset temperature value, and the temperature value collected in the current cycle is less than or equal to the sum of the temperature value collected in the previous cycle and the second preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the second preset relationship. or, If either the temperature value collected in the current cycle or the temperature value collected in the previous cycle is greater than the first preset temperature threshold, and the other is less than or equal to the first preset temperature value, then the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the second preset relationship.
[0014] Optionally, the error self-correction method for ultrasonic gas meters further includes: When the relationship between the temperature value collected in an adjacent cycle and the first preset temperature value is the third preset relationship, the ultrasonic gas meter is controlled to enter the normal working mode. In the normal operating mode, the upstream absolute time of flight is calculated based on the original envelope of the upstream signal, and the downstream absolute time of flight is calculated based on the original envelope of the downstream signal; The time difference is calculated based on the original waveforms of the upstream signal and the downstream signal. The instantaneous flow rate is calculated based on the upstream absolute flight time, the downstream absolute flight time, and the time difference. The process of determining the relationship between the temperature values collected in adjacent cycles and the first preset temperature value is a third preset relationship determination process, including: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both less than or equal to the first preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the third preset relationship.
[0015] The technical solution of this invention improves the reliability and accuracy of the received signal by setting the physical model of the received signal to a Gaussian mixture model. By setting the relationship between the temperature values collected in adjacent cycles and a first preset temperature value to a first preset relationship, the ultrasonic gas meter is controlled to enter a real-time compensation mode. In this mode, the model fitting parameters, upstream absolute time-of-flight compensation value, downstream absolute time-of-flight compensation value, and time difference compensation value of the physical model are calculated. This ensures that the values of each parameter in the physical model are temperature-dependent, reducing the impact of temperature on the received signal and further improving its reliability and accuracy. Furthermore, it provides a self-correcting compensation value update strategy, allowing the ultrasonic gas meter to self-correct errors based on temperature. Moreover, by setting the real-time compensation mode and calculating the instantaneous flow rate based on the compensated data, the metering reliability and accuracy of the instantaneous flow rate across the entire range can be improved.
[0016] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart of an error self-correction method for ultrasonic gas meters provided in an embodiment of the present invention; Figure 2 A flowchart of another error self-correction method for ultrasonic gas meters provided in an embodiment of the present invention; Figure 3 A flowchart of another error self-correction method for ultrasonic gas meters provided in an embodiment of the present invention; Figure 4 A flowchart of another error self-correction method for ultrasonic gas meters provided in an embodiment of the present invention. Detailed Implementation
[0019] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.
[0020] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and their variations, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0021] This invention provides an error self-correction method suitable for ultrasonic gas meters, which can be executed by the main control chip in the ultrasonic gas meter. Figure 1 A flowchart illustrating an error self-correction method for ultrasonic gas meters, provided as an embodiment of the present invention, is shown below. Figure 1 An error self-correction method for ultrasonic gas meters includes: S100. Based on the order of the preset Gaussian mixture model, the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient, establish the physical model of the received signal.
[0022] Specifically, the physical model for the received signal is a Gaussian mixture model. A Gaussian mixture model can combine multiple Gaussian components, thus approximating arbitrarily complex probability distributions. It can more accurately describe the actual noise and signal distributions, effectively distinguishing between valid signals and interference, and enhancing the system's noise immunity and robustness.
[0023] S200: Collect the upstream ultrasonic signal received by the first transducer and the downstream ultrasonic signal received by the second transducer respectively; perform data preprocessing on the upstream and downstream ultrasonic signals to obtain the original waveforms of the upstream and downstream signals; and extract the original envelope of the upstream signal corresponding to the original waveform of the upstream signal and the original envelope of the downstream signal corresponding to the original waveform of the downstream signal.
[0024] The part closer to the air inlet is considered upstream, and the part closer to the air outlet is considered downstream. The first transducer can be the upstream transducer, and the second transducer can be the downstream transducer.
[0025] Specifically, the process of acquiring the upstream ultrasonic signal is as follows: the second transducer sends an excitation signal, the first transducer receives the excitation signal and converts it into an ultrasonic signal, which is the upstream ultrasonic signal.
[0026] The process of acquiring the downstream ultrasonic signal is as follows: the first transducer sends an excitation signal, the second transducer receives the excitation signal and converts it into an ultrasonic signal, which is the downstream ultrasonic signal.
[0027] The upstream and downstream ultrasonic signals are then subjected to low-pass filtering to remove noise, yielding the original waveforms of the upstream and downstream signals, respectively. The original envelopes of the upstream and downstream signals are then extracted using the Hilbert transform and extremum method, respectively.
[0028] S300: Collect the temperature value output by the temperature sensor, and when the relationship between the temperature value collected in adjacent cycles and the first preset temperature value is the first preset relationship, control the ultrasonic gas meter to enter the real-time compensation mode.
[0029] The ultrasonic gas meter is equipped with a temperature sensor that can collect the ambient temperature in real time. The ultrasonic gas meter has a pre-stored first preset temperature value, the specific value of which can be set according to actual conditions.
[0030] Specifically, the main control chip in the ultrasonic gas meter collects the temperature values output by the temperature sensor and compares the temperature values collected in adjacent cycles with a first preset temperature value, outputting the comparison results. When the main control chip determines that the relationship between the temperature values collected in adjacent cycles and the first preset temperature value is the first preset relationship based on the comparison results, it controls the ultrasonic gas meter to enter real-time compensation mode. This indicates that the upstream absolute flight time compensation value, downstream absolute flight time compensation value, and time difference compensation value need to be recalculated to compensate for the original upstream absolute flight time, downstream absolute flight time, and time difference. By controlling the ultrasonic gas meter's mode based on the temperature collected in adjacent cycles, the influence of temperature on the measurement results can be reduced, improving measurement accuracy and reliability.
[0031] S400. In real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is preprocessed to obtain the model fitting parameters of the physical model.
[0032] The model fitting parameters include the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient. Preprocessing can involve fitting a Gaussian mixture model to the original signal envelope. For example, Gaussian mixture model fitting may include normalization and data processing based on a preset algorithm. The default order of the Gaussian mixture model is 2nd order.
[0033] Specifically, in real-time compensation mode, either the original envelope of the upstream signal or the original envelope of the downstream signal is selected for preprocessing. For example, taking the preprocessing of the original envelope of the upstream signal as an example, firstly, the original envelope of the upstream signal is normalized to obtain the normalized envelope of the upstream signal. Then, the slope of the upstream signal is calculated based on the normalized envelope of the upstream signal and preset feature points. The preset feature points are the maximum value, 50% of the maximum value, and 20% of the maximum value of the normalized envelope of the upstream signal. Then, based on the slope of the upstream signal and the current temperature, the model fitting parameters of the physical model are calculated using a lookup table method or a preset algorithm.
[0034] Understandably, the choice of using a lookup table method and preset algorithm to calculate model fitting parameters can be made based on actual conditions. For example, when the parameter storage table in the ultrasonic gas meter is not empty, the lookup table method is used to calculate the model fitting parameters of the physical model; when the parameter storage table in the ultrasonic gas meter is empty, the preset algorithm is used to calculate the model fitting parameters. The parameter storage table may include at least the order of the Gaussian mixture model, the model fitting parameters, the current temperature, and the signal slope. The signal slope includes the upstream signal slope and the downstream signal slope. The parameter storage table can be pre-stored in the ultrasonic gas meter, and the default parameter storage table in the ultrasonic gas meter is empty.
[0035] In addition, in other embodiments, the average envelope of the original envelopes of the upstream and downstream signals can be preprocessed to obtain the model fitting parameters of the physical model. The specific steps for preprocessing and obtaining the physical fitting parameters of the model are the same as those described above.
[0036] S500. Based on the original waveform of the upstream signal, the original waveform of the downstream signal, the reference waveform of the upstream signal, and the reference waveform of the downstream signal, calculate the upstream absolute flight time, the upstream absolute flight time compensation value, the downstream absolute flight time, the downstream absolute flight time compensation value, the time difference, and the time difference compensation value.
[0037] Specifically, the upstream absolute time of flight is calculated based on the upstream signal reference waveform. An upstream absolute time of flight compensation value is then calculated based on the original upstream signal waveform and the upstream signal reference waveform, and this compensation value is used to compensate for the upstream absolute time of flight. Similarly, the downstream absolute time of flight is calculated based on the downstream signal reference waveform. A downstream absolute time of flight compensation value is then calculated based on the original downstream signal waveform and the downstream signal reference waveform, and this compensation value is used to compensate for the downstream absolute time of flight. Finally, the time difference is calculated based on the original upstream and downstream signal waveforms, and a time difference compensation value is calculated based on the upstream and downstream signal reference waveforms, and this compensation value is used to compensate for the time difference.
[0038] In other words, in real-time compensation mode, the ultrasonic gas meter recalculates the upstream absolute flight time, upstream absolute flight time compensation value, downstream absolute flight time, downstream absolute flight time compensation value, time difference, and time difference compensation value to ensure that the ultrasonic gas meter can achieve error self-correction.
[0039] S600. Calculate the instantaneous flow rate based on the compensated upstream absolute flight time, the compensated downstream absolute flight time, and the compensated time difference.
[0040] Specifically, the compensated upstream absolute flight time T12 = T 12,ref +ΔT12. Where, T 12,refLet T12 be the upstream absolute flight time, and ΔT12 be the upstream absolute flight time compensation value. The compensated downstream absolute flight time T21 = T 21,ref +ΔT21. Where, T 21,ref Let ΔT21 be the upstream absolute flight time, and ΔT21 be the upstream absolute flight time compensation value. The compensated time difference ΔT = ΔT21 / ΔT21. ref -ΔT0. Where ΔT ref ΔT0 is the time difference, and ΔT0 is the time difference compensation value.
[0041] The formula for calculating instantaneous flow rate vfr is: ; Where L is the acoustic path length and S is the cross-sectional area.
[0042] By calculating instantaneous flow rate based on the compensated absolute flight time and the compensated time difference, temperature drift and zero drift caused by temperature changes can be corrected simultaneously, ensuring the accuracy and reliability of absolute flight time and time difference, thereby improving the measurement stability and reliability of instantaneous flow rate across the entire range.
[0043] The technical solution of this invention improves the reliability and accuracy of the received signal by setting the physical model of the received signal to a Gaussian mixture model. By setting the relationship between the temperature values collected in adjacent cycles and a first preset temperature value to a first preset relationship, the ultrasonic gas meter is controlled to enter a real-time compensation mode. In this mode, the model fitting parameters, upstream absolute time-of-flight compensation value, downstream absolute time-of-flight compensation value, and time difference compensation value of the physical model are calculated. This ensures that the values of each parameter in the physical model are temperature-dependent, reducing the impact of temperature on the received signal and further improving its reliability and accuracy. Furthermore, it provides a self-correcting compensation value update strategy, allowing the ultrasonic gas meter to self-correct errors based on temperature. Moreover, by setting the real-time compensation mode and calculating the instantaneous flow rate based on the compensated data, the metering reliability and accuracy of the instantaneous flow rate across the entire range can be improved.
[0044] Based on the above embodiments, optionally, the relationship between the temperature values collected in adjacent cycles and the first preset temperature value is a determination process of the first preset relationship, including: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both greater than the first preset temperature value, and the temperature value collected in the current cycle is greater than the sum of the temperature value collected in the previous cycle and the second preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the first preset relationship.
[0045] The first preset temperature value is a preset limit, which can be assumed to be room temperature, i.e., a temperature range of 15℃ to 25℃. The second preset temperature value can be 5℃.
[0046] Specifically, when the temperature value measured in the current cycle exceeds a first preset temperature value, the temperature value measured in the previous cycle also exceeds the first preset temperature value, and the deviation between the temperature value measured in the current cycle and the temperature value measured in the previous cycle is greater than 5°C, the relationship between the temperature values collected in adjacent cycles and the first preset temperature value is determined to be a first preset relationship. For example, the main control chip in the ultrasonic gas meter determines the relationship between the temperature values collected in adjacent cycles and the first preset temperature value to be a first preset relationship.
[0047] Figure 2 A flowchart of another error self-correction method for ultrasonic gas meters provided in this embodiment of the invention is shown below. Figure 2 Error self-correction methods applicable to ultrasonic gas meters include: S201. Based on the order of the preset Gaussian mixture model, the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient, establish the physical model of the received signal.
[0048] Specifically, the statistical characteristic parameters include: the mean μ of the k-th order Gaussian component. k and variance ; The calculation formula for the physical model is as follows: ; Among them, [A,α k ,μ k ,σ k [f, φ] represents the model fitting parameters, and k is the order of the Gaussian mixture model, k = 1, 2, ..., K. Let μ be the variance of the k-th order Gaussian distribution. k Let α be the mean. k Here, f is the weighting factor, and f is the transducer center operating frequency. Let t be the phase and t be the sampling time.
[0049] S202. Collect the upstream ultrasonic signal received by the first transducer and the downstream ultrasonic signal received by the second transducer respectively. Perform data preprocessing on the upstream and downstream ultrasonic signals to obtain the original waveforms of the upstream and downstream signals. Extract the original envelope of the upstream signal corresponding to the original waveform of the upstream signal and the original envelope of the downstream signal corresponding to the original waveform of the downstream signal.
[0050] S203. Collect the temperature value output by the temperature sensor, and when the relationship between the temperature value collected in adjacent cycles and the first preset temperature value is the first preset relationship, control the ultrasonic gas meter to enter the real-time compensation mode.
[0051] S204. In real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is normalized to obtain a normalized envelope, and the signal slope is calculated based on the normalized envelope and preset feature points.
[0052] The preset feature points are the corresponding positions and their x-coordinates of 20%, 50%, and 100% of the maximum value of the normalized envelope. Normalization methods can include normalization based on the maximum value and normalization based on the mean.
[0053] Specifically, the signal slope p can be a weighted value of the rising edge slope p1 and the falling edge slope p2 in the normalized envelope. For example, the formula for calculating the signal slope p can be: p = α × p1 + (1 - α) × p2; where α is an adjustable parameter.
[0054] The formulas for calculating the rising edge slope p1 and the falling edge slope p2 are the same. Taking the rising edge slope p1 as an example, its formula is: ; Among them, peak 100% For the point where the normalized envelope is maximized, pos 100% The peak is the x-coordinate of the point corresponding to the maximum value of the normalized envelope. 50% The value corresponding to 50% of the maximum value of the normalized envelope, pos 50% The peak is the x-axis corresponding to 50% of the maximum value of the normalized envelope. 20% The value corresponding to 20% of the maximum value of the normalized envelope, pos 20% The x-axis corresponds to 20% of the maximum value of the normalized envelope.
[0055] S205. Calculate the model fitting parameters of the physical model based on the signal slope and temperature value.
[0056] Specifically, when the parameter storage table is not empty, the two points adjacent to the signal slope are found using a lookup method. Based on the signal slope, the two points adjacent to the signal slope, and the corresponding temperatures of the two points, the model fitting parameters of the physical model are calculated. When the parameter storage table is empty, the model fitting parameters are calculated using the least squares method, gradient descent method, genetic algorithm, or differential evolution algorithm.
[0057] S206. Calculate the reference envelope based on the model fitting parameters.
[0058] The reference includes the upstream signal reference envelope and the downstream signal reference envelope.
[0059] S207. Based on the correlation coefficient between the original envelope and the reference envelope, the signal slope of the reference envelope, the signal slope of the normalized envelope, and the preset weight adjustment coefficient, establish a matching degree calculation model to characterize the goodness of fit.
[0060] The original envelope includes the original envelope of the upstream signal and the original envelope of the downstream signal.
[0061] Specifically, the formula for calculating the matching degree is: m = β × Rd + (1 - β) × R; where m is the matching degree, β is the preset weight adjustment coefficient, which is an adjustable parameter, typically 0.3. R is the correlation coefficient between the reference envelope and the original envelope, and Rd is the relative error between the signal slope of the reference envelope and the signal slope of the normalized envelope. For example, the relative error Rd = (p3 - p) / p3 × 100%; where p3 is the signal slope of the reference envelope, and p is the signal slope of the normalized envelope.
[0062] S208. Calculate the matching degree between the original envelope and the reference envelope based on the matching degree calculation model, and adjust the order of the Gaussian mixture model according to the matching degree.
[0063] Specifically, when the matching degree is in the first confidence interval, the current order of the Gaussian mixture model is maintained; when the matching degree is in the second confidence interval, the order of the Gaussian mixture model is increased; when the matching degree is in the third confidence interval, the model fitting parameters are determined to be misfitted; wherein, the lower limit of the first confidence interval is greater than the upper limit of the second confidence interval, and the upper limit of the third confidence interval is less than the lower limit of the second confidence interval.
[0064] For example, the first confidence interval is [3σ, 100], where 3σ = 99.73%; the second confidence interval is [2σ, 3σ]; and the third confidence interval is (0, 2σ).
[0065] That is, when the matching degree m ≥ 99.73% (3σ), it is considered reliable and the subsequent steps are continued; if 2σ ≤ matching degree m < 3σ, the order of the Gaussian mixture model is increased and step S204 is repeated; if the matching degree m < 2σ, it is considered a fitting error, an alarm is issued, and the real-time compensation mode is exited.
[0066] S209. Based on the original waveform of the upstream signal, the original waveform of the downstream signal, the reference waveform of the upstream signal, and the reference waveform of the downstream signal, calculate the upstream absolute flight time, the upstream absolute flight time compensation value, the downstream absolute flight time, the downstream absolute flight time compensation value, the time difference, and the time difference compensation value.
[0067] Specifically, the process of obtaining the upstream absolute time of flight includes: calculating the upstream absolute time of flight based on the upstream signal reference waveform and the threshold method.
[0068] The process of obtaining the upstream absolute time-of-flight compensation value includes: cross-correlation between the original waveform of the upstream signal and the reference waveform of the upstream signal, and calculating the upstream absolute time-of-flight compensation value.
[0069] The process of obtaining the downstream absolute time of flight includes: calculating the downstream absolute time of flight based on the threshold method according to the downstream signal reference waveform.
[0070] The process of obtaining the downstream absolute time-of-flight compensation value includes: cross-correlation between the original waveform of the downstream signal and the reference waveform of the downstream signal, and calculating the downstream absolute time-of-flight compensation value.
[0071] The process of obtaining the time difference includes: cross-correlation of the original waveforms of the upstream signal and the original waveforms of the downstream signal, and calculating the time difference.
[0072] The process of obtaining the time difference compensation value includes: cross-correlation of the upstream signal reference waveform and the downstream signal reference waveform, and calculating the time difference compensation value.
[0073] S210. Calculate the instantaneous flow rate based on the compensated upstream absolute flight time, the compensated downstream absolute flight time, and the compensated time difference.
[0074] The technical solution of this invention calculates model fitting parameters in real-time compensation mode and calculates the reference waveform based on the model fitting parameters. This is equivalent to establishing a theoretical model of the received signal and accurately and efficiently inverting the reference signal using the acquired signal. Furthermore, by establishing a matching degree calculation model to characterize the goodness of fit and calculating the matching degree between the original envelope and the reference envelope based on this matching degree calculation model, and adjusting the order of the Gaussian mixture model according to the matching degree, the accuracy of the received signal can be guaranteed.
[0075] Figure 3 A flowchart illustrating another error self-correction method for ultrasonic gas meters provided in this embodiment of the invention specifically demonstrates error self-correction when the parameter storage table is not empty. See also... Figure 3 Error self-correction methods applicable to ultrasonic gas meters include: S301. Based on the order of the preset Gaussian mixture model, the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient, establish a physical model of the received signal.
[0076] S302. Collect the upstream ultrasonic signal received by the first transducer and the downstream ultrasonic signal received by the second transducer respectively. Perform data preprocessing on the upstream and downstream ultrasonic signals to obtain the original waveforms of the upstream and downstream signals. Extract the original envelope of the upstream signal corresponding to the original waveform of the upstream signal and the original envelope of the downstream signal corresponding to the original waveform of the downstream signal.
[0077] S303. Collect the temperature value output by the temperature sensor, and when the relationship between the temperature value collected in adjacent cycles and the first preset temperature value is the first preset relationship, control the ultrasonic gas meter to enter the real-time compensation mode.
[0078] S304. In real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is normalized to obtain a normalized envelope, and the signal slope is calculated based on the normalized envelope and preset feature points.
[0079] S305. Obtain a point adjacent to the signal slope and less than or equal to the signal slope, and a point adjacent to the signal slope and greater than or equal to the signal slope.
[0080] S306. If the difference between the temperature values corresponding to two points is less than or equal to the second preset temperature value, calculate the model fitting parameters of the physical model by linear interpolation.
[0081] S307. If the difference between the temperature values corresponding to two points is greater than the second preset temperature value, calculate the model fitting parameters of the physical model using the preset algorithm.
[0082] The preset algorithms include least squares, gradient descent, genetic algorithm, or differential evolution algorithm.
[0083] S308. Calculate the reference envelope based on the model fitting parameters.
[0084] S309. Based on the correlation coefficient between the original envelope and the reference envelope, the signal slope of the reference envelope, the signal slope of the normalized envelope, and the preset weight adjustment coefficient, establish a matching degree calculation model to characterize the goodness of fit.
[0085] S310. Calculate the matching degree between the original envelope and the reference envelope based on the matching degree calculation model, and adjust the order of the Gaussian mixture model according to the matching degree.
[0086] S311. Based on the original waveform of the upstream signal, the original waveform of the downstream signal, the reference waveform of the upstream signal, and the reference waveform of the downstream signal, calculate the upstream absolute flight time, the upstream absolute flight time compensation value, the downstream absolute flight time, the downstream absolute flight time compensation value, the time difference, and the time difference compensation value.
[0087] S312. Calculate the instantaneous flow rate based on the compensated upstream absolute flight time, the compensated downstream absolute flight time, and the compensated time difference.
[0088] This invention provides an error self-correction method for ultrasonic gas meters through steps S301-S312. It can automatically identify error changes through prior physical quantities such as signal slope and temperature, establish a theoretical model of the received signal, and use the accurate and efficient inversion of the reference signal from the acquired signal, combined with digital signal processing methods, to compensate for error changes in real time. This not only ensures the metering accuracy under normal gas usage conditions, but also improves the anti-interference capability, that is, improves the metering reliability.
[0089] Optionally, before step S308, the method further includes: Store the current temperature, signal slope, order of Gaussian mixture model, and model fitting coefficients.
[0090] Based on the above embodiments, optionally, the process of obtaining the reference waveform includes: calculating the reference waveform when the phase parameter is zero phase according to the reference envelope and the physical model; wherein, the reference waveform includes the upstream signal reference waveform and the downstream signal reference waveform.
[0091] Figure 4 A flowchart of another error self-correction method for ultrasonic gas meters provided in this embodiment of the invention is shown below. Figure 4 Error self-correction methods applicable to ultrasonic gas meters include: S401. Based on the order of the preset Gaussian mixture model, the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient, establish the physical model of the received signal.
[0092] S402. Collect the upstream ultrasonic signal received by the first transducer and the downstream ultrasonic signal received by the second transducer respectively. Perform data preprocessing on the upstream and downstream ultrasonic signals to obtain the original waveforms of the upstream and downstream signals. Extract the original envelope of the upstream signal corresponding to the original waveform of the upstream signal and the original envelope of the downstream signal corresponding to the original waveform of the downstream signal.
[0093] S403: Collect the temperature value output by the temperature sensor.
[0094] S404. Determine whether the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is the first preset relationship; if yes, then execute S407; if no, then execute S405.
[0095] S405. Determine whether the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is the third preset relationship; if yes, then execute S408; if no, then execute S406.
[0096] Specifically, the process of determining the relationship between the temperature values collected in adjacent cycles and the first preset temperature value as the third preset relationship includes: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both less than or equal to the first preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the third preset relationship.
[0097] S406. Determine whether the relationship between the temperature value collected in an adjacent cycle and the first preset temperature value is the second preset relationship; if yes, execute S409; if no, execute S403.
[0098] Specifically, the process for determining the relationship between the temperature values collected in adjacent cycles and the first preset temperature value and the second preset relationship includes: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both greater than the first preset temperature value, and the temperature value collected in the current cycle is less than or equal to the sum of the temperature value collected in the previous cycle and the second preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the second preset relationship. or, If either the temperature value collected in the current cycle or the temperature value collected in the previous cycle is greater than a first preset temperature threshold, and the other is less than or equal to the first preset temperature threshold, then the relationship between the temperature value collected in the adjacent cycle and the first preset temperature threshold is determined to be a second preset relationship.
[0099] Understandably, to prevent frequent switching at critical points, the hysteresis width is set to 5℃ by default. That is, the entry condition for switching from normal operating mode to error self-correction mode is a temperature ≥30℃ or ≤10℃, and the exit condition is a temperature ≤25℃ or ≥15℃.
[0100] S407, Control the ultrasonic gas meter to enter real-time compensation mode.
[0101] S408, Control the ultrasonic gas meter to enter normal working mode.
[0102] S409. Control the ultrasonic gas meter to enter the error self-correction mode.
[0103] S410. In real-time compensation mode, preprocess the original envelope of the upstream signal or the original envelope of the downstream signal to obtain the model fitting parameters of the physical model.
[0104] S411. Based on the original waveform of the upstream signal, the original waveform of the downstream signal, the reference waveform of the upstream signal, and the reference waveform of the downstream signal, calculate the upstream absolute flight time, the upstream absolute flight time compensation value, the downstream absolute flight time, the downstream absolute flight time compensation value, the time difference, and the time difference compensation value.
[0105] S412. Calculate the instantaneous flow rate based on the compensated upstream absolute flight time, the compensated downstream absolute flight time, and the compensated time difference.
[0106] S413. In error self-correction mode, input the saved upstream absolute flight time compensation value, downstream absolute flight time compensation value and time compensation value to calculate the instantaneous flow rate.
[0107] S414. In normal operating mode, calculate the upstream absolute flight time based on the original envelope of the upstream signal, and calculate the downstream absolute flight time based on the original envelope of the downstream signal.
[0108] S415. Calculate the time difference based on the original waveforms of the upstream and downstream signals.
[0109] S416. Calculate the instantaneous flow rate based on the upstream absolute flight time, the downstream absolute flight time, and the time difference.
[0110] This invention provides an error self-correction method for ultrasonic gas meters through steps S401-S416. Specifically, it constructs a signal model suitable for ultrasonic gas meters, its associated parameters, and a parameter storage table. It also defines various error self-correction modes for ultrasonic gas meters, the switching conditions between modes, and a compensation value update strategy for error self-correction. This allows for the automatic identification of error changes through prior physical quantities in the ultrasonic gas meter, the establishment of a theoretical model of the received signal, and the accurate and efficient inversion of the reference signal using the acquired signal. Combined with digital signal processing methods, it compensates for error changes in real time, ensuring metering accuracy under normal gas usage conditions and improving anti-interference capabilities, thus enhancing metering reliability.
[0111] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0112] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A self-correction method for errors in ultrasonic gas meters, characterized in that, include: A physical model of the received signal is established based on the order of the pre-defined Gaussian mixture model, the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient. The upstream ultrasonic signal received by the first transducer and the downstream ultrasonic signal received by the second transducer are collected respectively. The upstream ultrasonic signal and the downstream ultrasonic signal are preprocessed to obtain the original waveform of the upstream signal and the original waveform of the downstream signal. The original envelope of the upstream signal corresponding to the original waveform of the upstream signal and the original envelope of the downstream signal corresponding to the original waveform of the downstream signal are extracted. The temperature value output by the temperature sensor is collected, and when the relationship between the temperature value collected in adjacent cycles and the first preset temperature value is the first preset relationship, the ultrasonic gas meter is controlled to enter the real-time compensation mode. In the real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is preprocessed to obtain the model fitting parameters of the physical model; wherein, the model fitting parameters include the weighting factors and statistical characteristic parameters of each Gaussian component, the center frequency and phase parameters of the transducer, and the amplitude gain coefficient. Based on the original waveform of the upstream signal, the original waveform of the downstream signal, the reference waveform of the upstream signal, and the reference waveform of the downstream signal, calculate the upstream absolute flight time, the upstream absolute flight time compensation value, the downstream absolute flight time, the downstream absolute flight time compensation value, the time difference, and the time difference compensation value. The instantaneous flow rate is calculated based on the compensated upstream absolute flight time, the compensated downstream absolute flight time, and the compensated time difference.
2. The error self-correction method for ultrasonic gas meters according to claim 1, characterized in that, The process of determining the relationship between the temperature values collected in adjacent cycles and the first preset temperature value includes: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both greater than the first preset temperature value, and the temperature value collected in the current cycle is greater than the sum of the temperature value collected in the previous cycle and the second preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the first preset relationship.
3. The error self-correction method for ultrasonic gas meters according to claim 1, characterized in that, In the real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is preprocessed to obtain the model fitting parameters of the physical model, including: In the real-time compensation mode, the original envelope of the upstream signal or the original envelope of the downstream signal is normalized to obtain a normalized envelope, and the signal slope is calculated based on the normalized envelope and preset feature points; wherein, the preset feature points are the corresponding positions and abscissas of the maximum values of the normalized envelope, namely 20%, 50%, and 100% of the maximum value. Calculate the model fitting parameters of the physical model based on the signal slope and the temperature value; Based on the signal slope and the temperature value, the model fitting parameters of the physical model are calculated, including: Find a point that is adjacent to the signal slope and is less than or equal to the signal slope, and a point that is adjacent to the signal slope and is greater than or equal to the signal slope; If the difference between the temperature values corresponding to two points is less than or equal to the second preset temperature value, the model fitting parameters of the physical model are calculated by linear interpolation. If the difference between the temperature values corresponding to two points is greater than the second preset temperature value, the model fitting parameters of the physical model are calculated by a preset algorithm; wherein, the preset algorithm includes least squares method, gradient descent method, genetic algorithm or differential evolution algorithm.
4. The error self-correction method for ultrasonic gas meters according to claim 3, characterized in that, After calculating the model fitting parameters of the physical model, the process includes: The reference envelope is calculated based on the model fitting parameters; wherein the reference includes the upstream signal reference envelope and the downstream signal reference envelope; Based on the correlation coefficient between the original envelope and the reference envelope, the signal slope of the reference envelope, the signal slope of the normalized envelope, and the preset weight adjustment coefficient, a matching degree calculation model for characterizing the goodness of fit is established; wherein, the original envelope includes the upstream signal original envelope and the downstream signal original envelope; The matching degree between the original envelope and the reference envelope is calculated based on the matching degree calculation model, and the order of the Gaussian mixture model is adjusted according to the matching degree.
5. The error self-correction method for ultrasonic gas meters according to claim 4, characterized in that, Adjusting the order of the Gaussian mixture model based on the matching degree includes: When the matching degree is within the first confidence interval, the order of the current Gaussian mixture model is maintained; When the matching degree is in the second confidence interval, the order of the Gaussian mixture model is increased. When the matching degree is in the third confidence interval, the model fitting parameters are determined to be incorrectly fitted; wherein, the lower limit of the first confidence interval is greater than the upper limit of the second confidence interval, and the upper limit of the third confidence interval is less than the lower limit of the second confidence interval.
6. The error self-correction method for ultrasonic gas meters according to claim 4, characterized in that, The process of obtaining the reference waveform includes: Calculate the reference waveform when the phase parameter is zero based on the reference envelope and the physical model; The reference waveform includes the upstream signal reference waveform and the downstream signal reference waveform.
7. The error self-correction method for ultrasonic gas meters according to claim 1, characterized in that, The process of obtaining the upstream absolute flight time includes: The upstream absolute flight time is calculated based on the upstream signal reference waveform using a threshold method. The process of obtaining the upstream absolute flight time compensation value includes: Cross-correlation is performed on the original waveform of the upstream signal and the reference waveform of the upstream signal to calculate the upstream absolute time-of-flight compensation value; The process of obtaining the downstream absolute flight time includes: The downstream absolute flight time is calculated based on the downstream signal reference waveform using a threshold method. The process of obtaining the downstream absolute flight time compensation value includes: Cross-correlation is performed on the original waveform of the downstream signal and the reference waveform of the downstream signal to calculate the absolute time-of-flight compensation value of the downstream signal. The process of obtaining the time difference includes: The time difference is calculated by cross-correlation of the original waveforms of the upstream signal and the original waveforms of the downstream signal. The process of obtaining the time difference compensation value includes: The time difference compensation value is calculated by cross-correlating the upstream signal reference waveform and the downstream signal reference waveform.
8. The error self-correction method for ultrasonic gas meters according to claim 1, characterized in that, The statistical characteristic parameters include: the mean μ of the k-th order Gaussian component. k and variance ; The calculation formula for the physical model is as follows: ; Among them, [A,α k ,μ k ,σ k [f, φ] represents the model fitting parameters, and k is the order of the Gaussian mixture model, k = 1, 2, ..., K. Let μ be the variance of the k-th order Gaussian distribution. k Let α be the mean. k Here, f is the weighting factor, and f is the transducer center operating frequency. Let t be the phase and t be the sampling time.
9. The error self-correction method for ultrasonic gas meters according to claim 1, characterized in that, Also includes: When the relationship between the temperature value collected in an adjacent cycle and the first preset temperature value is the second preset relationship, the ultrasonic gas meter is controlled to enter the error self-correction mode. In the error self-correction mode, the instantaneous flow rate is calculated by inputting the saved upstream absolute flight time compensation value, downstream absolute flight time compensation value, and time compensation value; The process of determining the relationship between the temperature values collected in adjacent cycles and the first preset temperature value as a second preset relationship includes: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both greater than the first preset temperature value, and the temperature value collected in the current cycle is less than or equal to the sum of the temperature value collected in the previous cycle and the second preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the second preset relationship. or, If either the temperature value collected in the current cycle or the temperature value collected in the previous cycle is greater than the first preset temperature threshold, and the other is less than or equal to the first preset temperature value, then the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the second preset relationship.
10. The error self-correction method for ultrasonic gas meters according to claim 1, characterized in that, Also includes: When the relationship between the temperature value collected in an adjacent cycle and the first preset temperature value is the third preset relationship, the ultrasonic gas meter is controlled to enter the normal working mode. In the normal operating mode, the upstream absolute time of flight is calculated based on the original envelope of the upstream signal, and the downstream absolute time of flight is calculated based on the original envelope of the downstream signal; The time difference is calculated based on the original waveforms of the upstream signal and the downstream signal. The instantaneous flow rate is calculated based on the upstream absolute flight time, the downstream absolute flight time, and the time difference. The process of determining the relationship between the temperature values collected in adjacent cycles and the first preset temperature value is a third preset relationship determination process, including: When the temperature value collected in the current cycle and the temperature value collected in the previous cycle are both less than or equal to the first preset temperature value, the relationship between the temperature value collected in the adjacent cycle and the first preset temperature value is determined to be the third preset relationship.