High-precision measurement method applied to ultrasonic flight time
Through phase locking algorithm and multi-point data fitting method, combined with triangular interpolation, the problem of low accuracy in ultrasonic flight time calculation under noise interference is solved, and high-precision flight time measurement is achieved.
Patent Information
- Application Number
- CN202510334523.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-07-04
AI Technical Summary
The existing ultrasonic time-of-flight calculation methods are not very accurate under noise interference and are easily affected by wrong data points, resulting in large errors in the calculation results.
The phase locking algorithm is used to obtain the position index of the maximum and minimum values, perform multi-point data fit and select zero crossing points to perform triangular interpolation, reduce the calculation complexity and improve the noise resistance, and obtain phase superposition as flight time by accumulating cycle waves.
It improves the calculation accuracy of ultrasonic flight time, effectively suppresses the influence of noise interference and wrong data points, and improves the accuracy of calculation results.
Smart Images

Figure CN120254864A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ultrasonic time - of - flight calculation, and particularly relates to a high - precision measurement method applied to ultrasonic time - of - flight. Background Art
[0002] The principle of ultrasonic metering is to estimate the instantaneous velocity by using the different time - of - flight experiences of two ultrasonic waves in the downstream and upstream directions respectively, and then calculate the instantaneous flow rate. The current technology for calculating the time - of - flight generally sets a threshold according to the maximum value of the received waveform, selects data points according to the threshold for linear interpolation or quadratic interpolation, and takes the zero - crossing point of the curve as the time - of - flight. Using two or three points near the threshold for interpolation, the obtained curve has poor anti - interference ability. When the locked data points are greatly interfered, the interpolated curve will deviate greatly; directly taking the calculated zero - crossing point as the calculation result has a large error. Summary of the Invention
[0003] In view of this, the present invention provides a high - precision measurement method applied to ultrasonic time - of - flight. By using a phase - locked algorithm to obtain the position indexes of the maximum and minimum values, envelope calculation is not required, reducing the computational complexity; using multi - point data for curve fitting instead of interpolation operations, improving the anti - interference degree against noise and reducing the influence of wrong data points on the calculation result; in addition, selecting the zero - crossing point of the data - fitting curve and the phase superposition obtained by triangular interpolation after accumulating multiple cycles after the zero - crossing point as the time - of - flight, effectively suppressing the problem of wrong waves while improving the calculation accuracy of the time - of - flight.
[0004] To achieve the above object, the present invention provides the following technical solutions:
[0005] A high - precision measurement method applied to ultrasonic time - of - flight, comprising the following steps:
[0006] S100. Obtain the position indexes of the maximum and minimum values through a phase - locked algorithm;
[0007] S200. Based on the output waveform of the received signal after passing through the medium to be measured, determine the maximum amplitude of the received signal, and lock the fitting data interval by taking a certain proportion of the maximum amplitude;
[0008] S300. Take the absolute values of the maximum value point and the minimum value point in the fitting data interval as the curve - fitting data;
[0009] S400. Perform least - squares calculation according to the curve - fitting data to obtain the fitting curve function;
[0010] S500. According to the fitting curve function, obtain the zero - crossing position t 粗 ;
[0011] S600. Select Z cycles after the zero-crossing position as the positioning data;
[0012] S700. Perform periodic accumulation on the positioning data to obtain the accumulated cycles;
[0013] S800. Perform triangular interpolation on the accumulated cycles to obtain the phase t 细 ;
[0014] S900. Calculate the final flight time T = t 粗 +t 细 .
[0015] Preferably, the specific steps of obtaining the maximum and minimum position indexes through the phase-locked algorithm are as follows: Perform periodic accumulation on the received signal respectively, poll the maximum and minimum values after accumulation, and obtain the position indexes of the maximum and minimum values.
[0016] Preferably, the specific steps of determining the maximum amplitude of the received signal and locking the fitting data interval by taking a certain proportion of the maximum amplitude are as follows: Poll to determine the maximum amplitude V max of the received signal, and the threshold V thrsh = λ * Vmax , where 0 < λ < 1, and determine the fitting data interval according to the threshold.
[0017] Preferably, the specific steps of performing least squares calculation based on the curve fitting data to obtain the fitting curve function are as follows: Construct the fitting curve model as:
[0018]
[0019] where a0, a1... a m are all fitting coefficients, and x is the sampling sequence number at the maximum and minimum values selected within the fitting data interval, that is, the position index value;
[0020] Obtain the sum of squared residuals:
[0021]
[0022] where y i is the signal amplitude corresponding to x i ;
[0023] Take the derivative of each unknown in the sum of squared residuals:
[0024]
[0025] Set the derivative result equal to 0:
[0026]
[0027] Where z is the total number of the maximum and minimum values selected within the fitting data interval, that is, the number of data points selected.
[0028] Convert the result with the derivative equal to 0 into matrix form, and obtain the fitting coefficients a0, a1... a m :
[0029]
[0030] That is:
[0031]
[0032] Preferably, the obtaining of the zero-crossing position specifically includes: taking the intersection point of the fitting curve and the X-axis that is close to the origin as the zero-crossing position, denoted as t 粗 .
[0033] Preferably, the triangular interpolation of the accumulated cycle specifically includes:
[0034] Take the maximum value of the result of the accumulated cycle and a total of M data points nearby for triangular interpolation.
[0035] Preferably, the taking of the maximum value of the result of the accumulated cycle and multiple data points nearby for triangular interpolation specifically includes:
[0036] Construct a cosine signal model:
[0037]
[0038] Where a is the amplitude, w is the angular frequency, φ is the phase, n is the independent variable, and N-1 data points are taken on each side of the center point during fitting. The number of data points taken during fitting is 2N-1;
[0039] Denote the maximum value of the accumulated cycle obtained and a total of M data points nearby as f i , and obtain the triangular interpolation formula:
[0040] f i = f(i), (i = -(M-1) / 2,..., 0,...(M-1) / 2).
[0041] M = 2N-1
[0042] Substitute the point coordinates of the positioning data into the triangular interpolation formula:
[0043]
[0044] Where a is the amplitude, w is the angular frequency, φ is the phase, and M is the number of data points used during interpolation.
[0045] Preferably, obtaining the phase t 细 Specifically, it includes:
[0046] Let
[0047]
[0048] where α i represents the calculated values of custom cosine and sine related to the phase;
[0049] Obtain the modified cosine signal model:
[0050] f(t) = α1cos(nw) + α2sin(nw)
[0051] where n is the independent variable and w is the angular frequency;
[0052] Represent the modified cosine signal model in matrix form and calculate the phase value:
[0053] f = Hα
[0054]
[0055]
[0056] After matrix calculation, obtain:
[0057] α = H -1 f
[0058] where:
[0059]
[0060] t 细 = -φ.
[0061] As can be seen from the above technical solutions, the high-precision measurement method for ultrasonic flight time provided by the present invention obtains the position indexes of the maximum and minimum values through the phase-locked algorithm, without the need for envelope calculation, reducing the computational complexity; performs curve fitting with multi-point data instead of interpolation operation, improving the anti-interference degree against noise and reducing the influence of incorrect data points on the calculation result; in addition, selects the zero-crossing point of the data fitting curve and the phase superposition obtained by triangular interpolation after accumulating multiple cycles after the zero-crossing point as the flight time, effectively suppressing the problem of false waves while improving the calculation accuracy of the flight time. Description of the Drawings
[0062] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0063] Figure 1 is a flowchart showing a high-precision measurement method applied to the time of flight of ultrasonic waves according to an exemplary embodiment;
[0064] Figure 2 is a flowchart showing obtaining the position indices of the maximum and minimum values through a phase-locked loop algorithm according to an exemplary embodiment;
[0065] Figure 3 is a schematic diagram showing obtaining the position indices of the maximum and minimum values after polling and accumulating the maximum and minimum values according to an exemplary embodiment;
[0066] Figure 4 is a flowchart showing obtaining the fitting curve function through least squares calculation based on curve-fitted data according to an exemplary embodiment;
[0067] Figure 5 is a flowchart showing performing triangular interpolation by accumulating cycles according to an exemplary embodiment. Detailed implementation manners
[0068] The present invention discloses a high-precision measurement method applied to the time of flight of ultrasonic waves. By using a phase-locked loop algorithm to obtain the position indices of the maximum and minimum values, envelope calculation is not required, reducing the computational complexity; curve fitting is performed with multi-point data instead of interpolation operations, improving the anti-interference ability against noise and reducing the influence of incorrect data points on the calculation results; in addition, the zero-crossing point of the data fitting curve and the phase superposition obtained by triangular interpolation after accumulating multiple cycles after the zero-crossing point are selected as the time of flight, effectively suppressing the problem of wrong waves while improving the calculation accuracy of the time of flight.
[0069] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0070] In an exemplary embodiment of the present disclosure, a high-precision measurement method applied to the time of flight of ultrasonic waves is provided, as Figure 1 shown.Figure 1 is a flowchart showing a high-precision measurement method applied to the ultrasonic time of flight according to an exemplary embodiment; Figure 2 is a flowchart showing obtaining the position indices of the maximum and minimum values through a phase-locked loop algorithm according to an exemplary embodiment; Figure 3 is a schematic diagram showing obtaining the position indices of the maximum and minimum values after polling and accumulating the maximum and minimum values according to an exemplary embodiment; Figure 4 is a flowchart showing obtaining a fitting curve function through least squares calculation based on curve-fitted data according to an exemplary embodiment; Figure 5 is a flowchart showing performing triangular interpolation by accumulating cycles according to an exemplary embodiment. The following will be explained in conjunction with Figures 1 to 5 for explanation.
[0071] Some specific embodiments described below are intended to facilitate those skilled in the art to understand this embodiment, and this embodiment is not limited to some specific embodiments described below.
[0072] Referring to Figure 1 , a high-precision measurement method applied to the ultrasonic time of flight provided by an exemplary embodiment of the present disclosure includes the following steps:
[0073] Step S100, obtaining the position indices of the maximum and minimum values through a phase-locked loop algorithm;
[0074] Step S200, determining the maximum amplitude of the received signal and locking a fitting data interval by taking a certain proportion of the maximum amplitude;
[0075] Step S300, taking the absolute values of the maximum and minimum points within the fitting data interval as curve-fitted data;
[0076] Step S400, performing least squares calculation based on the curve-fitted data, performing polynomial curve fitting, and obtaining a fitting curve function;
[0077] Step S500, obtaining the zero-crossing position t 粗 ;
[0078] Step S600, selecting Z cycles after the zero-crossing position as positioning data;
[0079] Step S700, performing periodic accumulation on the positioning data to obtain accumulated cycles;
[0080] Step S800, performing triangular interpolation on the accumulated cycles to obtain the phase t 细 ;
[0081] Step S900, calculating the final time of flight T = t粗 +t 细 。
[0082] Exemplarily, referring to Figure 2 , step S100, obtaining the position indexes of the maximum value and the minimum value through a phase-locked algorithm specifically includes:
[0083] Step S101, performing periodic accumulation on the received signals respectively;
[0084] Step S102, polling the maximum value and the minimum value after accumulation to obtain the position indexes of the maximum value and the minimum value.
[0085] The phase-locked algorithm is to perform periodic accumulation on two received signals respectively, and poll the maximum value and the minimum value after accumulation to obtain the position indexes of the maximum value and the minimum value. In this embodiment, the received signal is of unit standard amplitude. Referring to Figure 3 , taking the K-fold sampling rate as an example for illustration:
[0086] After performing periodic accumulation, there are u cycles in total, and a total of K points x0, x1,..., x K-1 are retained, and the accumulation of each point can be expressed as:
[0087]
[0088] Search the K accumulated points to determine the position indexes of the maximum value and the minimum value.
[0089] Step S200, determining the maximum amplitude of the received signal and locking a fitting data interval by taking a certain proportion of the maximum amplitude specifically includes:
[0090] Based on the output waveform of the received signal after passing through the medium to be measured, polling to determine the maximum amplitude V max of the received signal, and the threshold V thrsh =λ*V max , 0 < λ < 1, and determining the fitting data interval according to the threshold. For example, λ = 0.15.
[0091] After performing step S300, taking the absolute values of the maximum value point and the minimum value point in the fitting data interval determined according to the threshold as the curve fitting data, additionally referring to Figure 4 , where step S400, performing least squares calculation according to the curve fitting data to obtain the fitting curve function specifically includes:
[0092] Step S401, constructing a fitting curve model, specifically:
[0093]
[0094] where, a0, a 1…… a mThey are all fitting coefficients. x is the sampling sequence number at the maximum and minimum values selected within the fitting data interval, that is, the position index value, and y is the signal amplitude;
[0095] Step S402: Calculate the sum of squared residuals for the fitting curve model in step S401, specifically:
[0096]
[0097] where x i is the sampling sequence number at the maximum and minimum values selected within the fitting data interval, that is, the position index value, and y i is the signal amplitude; Fit a curve with this to make the calculation result of the obtained curve close to the actually received signal value.
[0098] Step S403: Take the derivative of each unknown in the sum of squared residuals in step S402, specifically:
[0099]
[0100] where a0, a 1…… a m are all fitting coefficients, x i is the sampling sequence number at the maximum and minimum values selected within the fitting data interval, that is, the position index value, and y i is the signal amplitude.
[0101] Step S404: Set the derivative result in step S403 equal to 0, specifically:
[0102]
[0103] where z is the total number of maximum and minimum values selected within the fitting data interval, that is, the number of data points selected, x i is the sampling sequence number at the maximum and minimum values selected within the fitting data interval, that is, the position index value, and y i is the signal amplitude.
[0104] Step S405: Convert the result of setting the derivative result in step S404 equal to 0 into matrix form and obtain the fitting coefficients a0, a 1…… a m , specifically:
[0105]
[0106] That is:
[0107]
[0108] where x iis the sampling number of the maximum and minimum values selected in the fitting data interval, that is, the position index value, y i is the signal amplitude.
[0109] According to the fitting data found in step S300 and the curve fitting method in the aforementioned step S400, a fitting curve can be obtained.
[0110] In step S500, the zero-crossing position t is obtained according to the fitting curve function. 粗 Specifically include:
[0111] The intersection point of the fitting curve obtained in step S405 and the X-axis close to the origin is taken as the zero crossing position, denoted as t 粗 .
[0112] Continue to execute step S600, select Z cycles after the zero-crossing position as positioning data, for example, Z=5.
[0113] Continue to execute step S700, periodically accumulate the positioning data to obtain an accumulated cycle.
[0114] In step S800, triangular interpolation is performed on the accumulated frequency to obtain the phase t 细 Specifically include:
[0115] Step S801: construct a cosine signal model, specifically:
[0116]
[0117] Where a is the amplitude, w is the angular frequency, φ is the phase, and n is the independent variable. In step S300, N-1 data points are taken on the left and right of the center point during fitting. The number of data points taken during fitting is 2N-1, that is, N = (the number of data points taken during fitting + 1) / 2.
[0118] Step S802: record the maximum value obtained by accumulating the frequency and the M data points nearby as f i , we get the trigonometric interpolation formula, which is:
[0119] f i =f(i),(i=-(M-1) / 2,...,0,...(M-1) / 2)
[0120] Wherein, M=2N-1, N=(the number of data points taken during fitting+1) / 2.
[0121] Step S803: Substitute the point coordinates of the positioning data into the triangular interpolation formula, specifically:
[0122]
[0123] Among them, a is the amplitude, w is the angular frequency, φ is the phase, and M is the number of data points used in interpolation.
[0124] Step S804: Obtain the modified cosine signal model. Specifically, let
[0125]
[0126] Among them, α1 is a user-defined cosine calculation value related to the phase, and α2 is a user-defined sine calculation value related to the phase.
[0127] The obtained modified cosine signal model is:
[0128] f(t) = α1cos(nw) + α2sin(nw)
[0129] Among them, n is the independent variable and w is the angular frequency.
[0130] Step S805: Represent the modified cosine signal model in matrix form and obtain the phase value. Specifically:
[0131] f = Hα
[0132]
[0133] Among them, w is the angular frequency and M is the number of data points used in interpolation.
[0134] Among them:
[0135]
[0136] Among them, α1 is the user-defined cosine calculation value related to the phase in step S804, and α2 is the user-defined sine calculation value related to the phase in step S804
[0137] Obtain t 细 = -φ.
[0138] Finally, execute step S900: t 粗 + t 细 Obtain the final flight time T.
[0139] In this embodiment, the position indexes of the maximum and minimum values are obtained through the phase-locked loop algorithm, eliminating the need for envelope calculation and reducing the computational complexity. Curve fitting is performed using multi-point data instead of interpolation, improving the anti-interference ability against noise and reducing the impact of incorrect data points on the calculation results. Additionally, the phase superposition obtained by selecting the zero-crossing point of the data fitting curve and performing triangular interpolation after accumulating multiple cycles after the zero-crossing point is used as the flight time, effectively suppressing the problem of false waves while improving the calculation accuracy of the flight time.
[0140] The foregoing description of the disclosed embodiments enables those skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A high-precision measurement method applied to ultrasonic time-of-flight, characterized in that, It includes the following steps: S100. Obtain the position indexes of the maximum value and the minimum value through a phase-locked algorithm; S200. Determine the maximum amplitude of the received signal, and lock the fitting data interval by taking a certain proportion of the maximum amplitude; S300. Take the absolute values of the maximum value point and the minimum value point within the fitting data interval as the curve fitting data; S400. Perform least-squares calculation according to the curve fitting data to obtain a fitting curve function; S500. Obtain the zero-crossing position t according to the fitting curve function 粗 ; S600. Select Z cycles after the zero-crossing position as the positioning data; S700. Perform periodic accumulation on the positioning data to obtain the accumulated cycles; S800. Perform triangular interpolation on the cumulative cycle to obtain the phase t 细 ; S900. Calculate the final flight time T = t 粗 + t 细 .
2. The high-precision measurement method applied to the time of flight of ultrasonic waves according to claim 1, characterized in that, The obtaining of the position indexes of the maximum value and the minimum value through the phase-locked algorithm specifically includes: performing periodic accumulation on the received signal respectively, polling the maximum value and the minimum value after accumulation, and obtaining the position indexes of the maximum value and the minimum value.
3. The high-precision measurement method applied to ultrasonic time-of-flight according to claim 2, characterized in that, The determination of the maximum amplitude of the received signal and the locking of the fitting data interval by taking a certain proportion of the maximum amplitude specifically includes: polling to determine the maximum amplitude V of the received signal max , threshold V thrsh = λ * Vmax , 0 < λ < 1, and determining the fitting data interval according to the threshold 4. The high-precision measurement method applied to ultrasonic time-of-flight according to claim 1, characterized in that, The performing of least-squares calculation according to the curve fitting data to obtain a fitting curve function specifically includes: constructing a fitting curve model as: wherein, a0, a 1…… a m are all fitting coefficients, and x is the sampling sequence number at the maximum and minimum values selected within the fitting data interval, that is, the position index value; Obtaining the sum of squared residuals: where y i is the signal amplitude corresponding to x i ; Taking the derivative of each unknown in the sum of squared residuals: Making the derivative result equal to 0: where z is the total number of the maximum value and the minimum value selected within the fitting data interval, that is, the number of selected data points; Convert the result of setting the derivative equal to 0 into matrix form, and obtain the fitting coefficients a0 and a 1…… a m : That is:
5. The high-precision measurement method applied to time-of-flight ultrasonic according to claim 1, wherein The obtaining of the zero-crossing position specifically includes: taking the intersection point of the fitting curve and the X-axis that is closer to the origin as the zero-crossing position, denoted as t 粗 .
6. The high-precision measurement method applied to the time of flight of ultrasonic waves according to claim 4, characterized in that, The performing of triangular interpolation on the accumulated cycles specifically includes: Taking the result maximum value of the accumulated cycles and M data points nearby for triangular interpolation.
7. The high-precision measurement method applied to the time of flight of ultrasonic waves according to claim 6, characterized in that, The taking of the result maximum value of the accumulated cycles and multiple data points nearby for triangular interpolation specifically includes: Constructing a cosine signal model: where a is the amplitude, w is the angular frequency, φ is the phase, n is the independent variable, taking N - 1 data points on each side of the center point during fitting, and the number of data points taken during fitting is 2N - 1; Denote the maximum value obtained by accumulating cycles and a total of M data points in the vicinity thereof as f i , and obtain a trigonometric interpolation formula: f i = f(i), (i = -(M - 1) / 2,..., 0,...(M - 1) / 2). M = 2N - 1 Substituting the point coordinates of the positioning data into the triangular interpolation formula: where a is the amplitude, w is the angular frequency, φ is the phase, and M is the number of data points used during interpolation.
8. The high-precision measurement method applied to the time of flight of ultrasonic waves according to claim 7, characterized in that The obtaining of phase t 细 Specifically, it includes: Making where α i represents the calculated values of custom cosine and sine related to the phase; Obtaining a modified cosine signal model: f(t) = α1cos(nw) + α2sin(nw) where n is the independent variable and w is the angular frequency; Representing the modified cosine signal model in matrix form and obtaining the phase value: f = Hα Obtaining after matrix calculation: α = H -1 f where: t fine = -φ.