Method and device for measuring ultrasonic flight time, electronic equipment and readable medium
By performing waveform matching analysis and related calculations on the ultrasonic time-of-flight measurement method, combined with cosine interpolation to correct the time offset value, and dynamically adjusting the amplification factor and filtering processing, the problem of accuracy and efficiency in ultrasonic time-of-flight measurement is solved, achieving high-precision and low-complexity measurement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-03-31
AI Technical Summary
Existing ultrasonic time-of-flight measurement methods cannot balance measurement accuracy and computational efficiency, resulting in reduced practicality and reliability of measurement equipment.
By applying a drive signal to the transducer, acquiring the transmitted and received waveform sequences, performing waveform matching analysis and related calculations, correcting the time offset value using cosine interpolation, dynamically adjusting the amplification factor and filtering, reducing noise interference, and calculating wind speed and direction.
It achieves high-precision ultrasonic time-of-flight measurement, reduces computational complexity and hardware resource consumption, adapts to different environments, and improves the practicality and reliability of the measurement equipment.
Smart Images

Figure CN121762871A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of ultrasonic measurement technology, and in particular to a method, apparatus, electronic device, and readable medium for measuring ultrasonic time of flight. Background Technology
[0002] In ultrasonic time-of-flight measurement scenarios (such as mine ventilation wind speed detection and fluid velocity measurement), the accuracy of ultrasonic time-of-flight measurement directly determines the reliability of subsequent calculations of parameters such as wind speed and distance. Traditional measurement methods mainly rely on thresholding or cross-correlation methods. The thresholding method sets a fixed threshold and uses the time difference between the first time the transmitted and received signals exceed the threshold as the flight time. Although the calculation is simple, it is easily affected by medium interference and signal nonlinear distortion, which can lead to timing deviations. The cross-correlation method obtains the delay time by calculating the correlation of the entire sequence of transmitted and received signals. Although it has better anti-interference capabilities than the thresholding method, it requires complex calculations on the complete signal sequence, resulting in a large computational load and consuming a lot of hardware resources, making it difficult to meet the needs of real-time measurement.
[0003] Currently, neither the threshold method nor the cross-correlation method can balance measurement accuracy and computational efficiency when measuring ultrasonic time-of-flight, greatly reducing the practicality and reliability of ultrasonic measuring equipment.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides a method, apparatus, electronic device, and readable medium for measuring ultrasonic time of flight, in order to solve the aforementioned technical problem of "being unable to balance measurement accuracy and computational efficiency when measuring ultrasonic time of flight".
[0006] According to one aspect of the embodiments of this application, this application provides a method for measuring the time of flight of an ultrasonic wave, comprising: applying a driving signal to a first transducer to cause the first transducer to emit an ultrasonic signal corresponding to the driving signal; starting a timer and acquiring the transmitted waveform sequence of the transmitted electrical signal; waiting for a minimum flight time and then acquiring the count value of the timer and the received waveform sequence of the received electrical signal, wherein the amplitude of the received electrical signal is within a preset range; performing waveform matching analysis on the transmitted waveform sequence and the received waveform sequence to obtain a time offset value of the received waveform sequence relative to the transmitted waveform sequence; and using the time offset value to correct a coarse value of the flight time to obtain a first absolute flight time of the ultrasonic signal from the first transducer to the second transducer.
[0007] By switching the transceiver transducer using a switching circuit, the second absolute time of flight after the switch can be obtained. Waveform matching is performed on the received waveforms of the first and second time-of-flight periods, and correlation calculations are performed to obtain the offset time, which is used to correct the difference between the first minimum time-of-flight period and the second minimum time-of-flight period to obtain the relative time-of-flight period.
[0008] Optionally, converting the ultrasonic signal into a received electrical signal includes: receiving an echo signal corresponding to the ultrasonic signal; performing an acoustic-to-electrical conversion on the echo signal to obtain an initial electrical signal; determining the amplification factor based on the output amplitude of the initial electrical signal, and performing a first amplification operation on the initial electrical signal according to the amplification factor; filtering the initial electrical signal after the first amplification operation; and performing a second amplification operation on the filtered initial electrical signal according to the amplification factor to obtain the received electrical signal.
[0009] Optionally, waveform matching analysis is performed on the transmitted waveform sequence and the received waveform sequence to obtain the time offset value of the received waveform sequence relative to the transmitted waveform sequence. This includes: calculating the cross-correlation function of the transmitted waveform sequence and the received waveform sequence to obtain a cross-correlation sequence; determining the maximum value in the cross-correlation sequence and determining the index position corresponding to the maximum value; obtaining the target cross-correlation value at two positions adjacent to the index position, wherein the target cross-correlation value includes the cross-correlation value before the index position and the cross-correlation value after the index position; and performing cosine interpolation on the maximum value and the target cross-correlation value to obtain the time offset value.
[0010] Optionally, the count value is corrected using a time offset value to obtain the first flight time of the ultrasonic signal from the first transducer to the second transducer, including: obtaining the number of sampling points corresponding to the index position; adding the number of sampling points to the time offset value to obtain the total offset value; obtaining the sampling frequency when the waveform is acquired, and dividing the total offset value by the sampling frequency to obtain the time compensation value; subtracting the time compensation value from the count value to obtain the first flight time from the first transducer to the second transducer.
[0011] Optionally, after obtaining the first flight time, the method further includes calculating the current wind speed in the following manner: calculating the second flight time of the ultrasonic signal from the second transducer to the first transducer; accurately calculating the two-way flight time difference by calculating the cross-correlation of the forward and reverse received waveforms and adding the difference between the two minimum flight times; determining the path length and path direction between the first transducer and the second transducer, and determining the angle between the path direction and the current wind direction; and calculating the current wind speed based on the two-way flight time difference, the path length, and the angle.
[0012] According to another aspect of the embodiments of this application, this application provides an ultrasonic time-of-flight measurement device, including a processing module, a transmitting module, a receiving module, a transceiver switching module, a first transducer, a second transducer, a timing module, and an analog-to-digital conversion module; the processing module is used to send control commands to the transmitting module and the transceiver switching module; the transmitting module is used to generate a drive signal upon receiving the control command; the transceiver switching module is used to, upon receiving the control command, route the drive signal to the first transducer in the transmitting state to transmit an ultrasonic signal, and route the echo signal received by the second transducer to the receiving module in the receiving state; the receiving module is used to condition the echo signal and output a received electrical signal; the analog-to-digital conversion module... The module is used to acquire the transmitted electrical signals from the transmitting module and the received electrical signals from the receiving module, and send the acquisition results to the processing module. The transmitted electrical signals are obtained by coupling in the drive signal, and the acquisition results include the transmitted waveform sequence of the transmitted electrical signals and the received waveform sequence of the received electrical signals. The timing module is used to record the start time of the transmitted electrical signals, the end time of the transmitted signals, the arrival time of the minimum flight time, and the reception waveform convergence time, so as to transmit the timing values to the processing module. The processing module is also used to perform waveform matching analysis on the transmitted waveform sequence and the received waveform sequence to obtain the time offset value, and calculate the first flight time of the ultrasonic signal between the first transducer and the second transducer based on the timing value and the time offset value.
[0013] Optionally, the receiving module includes a programmable gain amplifier and a bandpass filter. The programmable gain amplifier is used to dynamically adjust the amplification factor of the echo signal so that the amplitude of the output received electrical signal is within a preset range. The bandpass filter is used to filter the amplified echo signal to suppress noise.
[0014] Optionally, the first transducer and the second transducer are set opposite each other with a preset distance and a preset angle. The preset distance is the straight-line distance between the first transducer and the second transducer, and the preset angle is the angle between the direction of the straight-line distance and the current wind direction.
[0015] According to another aspect of the embodiments of this application, this application provides an electronic device, including a memory, a processor, a communication interface and a communication bus. The memory stores a computer program that can run on the processor. The memory and the processor communicate with each other through the communication bus and the communication interface. When the processor executes the computer program, it implements the steps of the above method.
[0016] According to another aspect of the embodiments of this application, this application also provides a computer-readable medium having processor-executable non-volatile program code that causes the processor to perform the above-described method.
[0017] Compared with related technologies, the technical solutions provided in this application have the following advantages: This application provides a method for measuring ultrasonic time of flight, comprising: obtaining the resultant velocity of ultrasonic transmission based on the transducer installation distance and the wind direction (headwind and tailwind), and then obtaining the minimum and maximum values of the flight time. The absolute and relative flight times of the ultrasonic waves under headwind and tailwind conditions are then calculated. The uplink absolute flight time measurement method is as follows: a drive signal is applied to the downwind transducer to cause it to emit an ultrasonic signal corresponding to the drive signal; a timer is started and the transmitted waveform sequence of the transmitted electrical signal is acquired; after the counter reaches the minimum flight time, the received waveform sequence is acquired; waveform matching analysis is performed on the transmitted and received waveform sequences to obtain the time offset of the received waveform sequence relative to the transmitted waveform sequence; this is added to the minimum flight time recorded by the counter to obtain the uplink absolute flight time. Similarly, the downlink absolute flight time can be obtained by switching the transducer using a switching circuit. The relative flight time calculation method is as follows: correlation calculations are performed on the uplink and downlink received waveforms to obtain the time difference between the two received waveforms; this is added to the difference between the minimum uplink and downlink flight times to obtain the relative flight time. By obtaining the absolute and relative flight times, the wind speed can be calculated. This solves the problem of balancing measurement accuracy and computational efficiency when measuring ultrasonic time-of-flight. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of the hardware environment for an optional ultrasonic time-of-flight measurement method provided according to an embodiment of this application; Figure 2 A flowchart illustrating an optional ultrasonic time-of-flight measurement method according to an embodiment of this application; Figure 3 This is a schematic diagram illustrating the absolute flight time parameters in an embodiment of this application; Figure 4 This is a schematic diagram illustrating the relative flight time parameters in an embodiment of this application; Figure 5 This is a schematic diagram illustrating the relevant calculations and interpolation methods in the embodiments of this application; Figure 6 This is a schematic diagram of an optional wind speed measurement according to an embodiment of this application; Figure 7 This is a block diagram of an optional ultrasonic time-of-flight measurement device according to an embodiment of this application; Figure 8 This is a schematic diagram of an optional ultrasonic time-of-flight acquisition circuit according to an embodiment of this application; Figure 9 This is a schematic diagram of an optional electronic device structure provided in an embodiment of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustration and has no specific meaning in itself. Therefore, "module" and "part" may be used interchangeably.
[0023] In ultrasonic time-of-flight measurement scenarios (such as mine ventilation wind speed detection and fluid velocity measurement), the accuracy of ultrasonic time-of-flight measurement directly determines the reliability of subsequent calculations of parameters such as wind speed and distance. Traditional measurement methods mainly rely on thresholding or cross-correlation methods. The thresholding method sets a fixed threshold and uses the time difference between the first time the transmitted and received signals exceed the threshold as the flight time. Although the calculation is simple, it is easily affected by medium interference and signal nonlinear distortion, which can lead to timing deviations. The cross-correlation method obtains the delay time by calculating the correlation of the entire sequence of transmitted and received signals. Although it has better anti-interference capabilities than the thresholding method, it requires complex calculations on the complete signal sequence, resulting in a large computational load and consuming a lot of hardware resources, making it difficult to meet the needs of real-time measurement.
[0024] Currently, neither the threshold method nor the cross-correlation method can balance measurement accuracy and computational efficiency when measuring ultrasonic time-of-flight, greatly reducing the practicality and reliability of ultrasonic measuring equipment.
[0025] To address the problems mentioned in the background art, according to one aspect of the embodiments of this application, an embodiment of a method for measuring ultrasonic time of flight is provided.
[0026] Optionally, in the embodiments of this application, the above-described method for measuring ultrasonic time-of-flight can be applied to, for example... Figure 1 The hardware environment shown consists of terminal 101 and server 103. Figure 1As shown, server 103 is connected to terminal 101 via a network and can be used to provide services to the terminal or clients installed on the terminal. Database 105 can be set up on the server or independently of the server to provide data storage services for server 103. The network mentioned above includes, but is not limited to, wide area network, metropolitan area network or local area network. Terminal 101 includes, but is not limited to, PC, mobile phone, tablet computer, etc.
[0027] The ultrasonic time-of-flight measurement method in this embodiment can be executed by server 103, or it can be executed jointly by server 103 and terminal 101, such as... Figure 2 As shown, it includes: Step 201: Apply a driving signal to the first transducer so that the first transducer emits an ultrasonic signal corresponding to the driving signal; Step 202: Start the counter and collect the length T12[n] of the transmitted signal sequence; Step 203: After waiting for the minimum flight time t12 = l / (340 + vmax), collect the length of the received signal sequence R12[n]. Step 204: Switch the send / receive channel; Step 205: Apply a driving signal to the second transducer so that the second transducer emits an ultrasonic signal corresponding to the driving signal.
[0028] Step 206: Start the counter and collect the length T21[n] of the transmitted signal sequence.
[0029] Step 207: After waiting for the minimum flight time t21 = l / (340 - vmin), collect the length of the received signal sequence R21[n].
[0030] Step 208: The extreme time offset Δt12 is obtained by the correlation operation between T12 and R12; the extreme time offset Δt21 is obtained by the correlation operation between T21 and R21; the extreme time offset Δt is obtained by the correlation operation between R12 and R21; tof12 = t12 + Δt12; tof21 = t21 + Δt21; tof12 - tof21 = Δt.
[0031] In wind speed environmental measurement, the maximum wind speed is vmax, the minimum wind speed is vmin, and the transducer probe distance is L. Under tailwind conditions, the minimum flight time is L / (340+vmax), and the minimum flight time under headwind conditions is L / (340-vmin). That is, within the minimum flight time, the echo will not arrive, so there is no need to perform AD acquisition and related calculations in the later stage, which greatly reduces the computing pressure on the processor.
[0032] By applying a driving signal to the first transducer to excite ultrasonic wave transmission, a counter is simultaneously activated to collect the transmitted waveform sequence; after waiting for the minimum flight time, the received waveform sequence is collected, and the absolute flight time is calculated through correlation operations between the transmitted and received sequences.
[0033] Figure 3 This document describes the absolute flight time parameters for embodiments of this application. t0 is the start point of the ultrasonic transmitted waveform; t1 is the end point of the ultrasonic transmitted waveform; t2 is the arrival time of the received waveform at maximum wind speed when the transducer probe distance is known, which is the minimum flight time and also a coarse value of the flight time; t3 is the arrival time of the received waveform at minimum wind speed when the transducer probe distance is known, which is the maximum flight time. The received waveform must arrive between the minimum and maximum flight times. Correlation calculations are performed with the transmitted waveform within this interval to reduce processor operation combinations and noise interference; t4 is the end time of the received waveform under the minimum flight time condition; t5 is the end time of the received waveform under the maximum flight time condition.
[0034] Figure 4 This section describes the relative flight time parameters for embodiments of this application. t12 is the minimum downlink flight time; t21 is the minimum uplink flight time; correlation operations are performed between the t2-t4 sampling sequence and the t3-t5 sampling sequence to obtain the time difference between the two received waveforms. Adding t21-t12 gives the difference between the uplink and downlink flight times, avoiding the error amplification problem caused by directly subtracting the downlink time from the uplink time.
[0035] Figure 5 This is a schematic diagram of the correlation calculation and interpolation method in an embodiment of this application. The original signals are the transmitted waveform and the received waveform; through correlation calculation, the maximum correlation value of the two signals is 0.9056, at which point the signal offset point is -25, which can only be an integer value. In order to improve the accuracy, we sample cosine interpolation and obtain a maximum correlation value of 0.9105, at which point the offset point is -25.28, thus improving the accuracy of the flight time calculation.
[0036] The transmitted waveform is actually the electrical signal of the receiving circuit coupled out from the transmitting circuit that drives the first transducer through electromagnetic induction or voltage division. The coupled signal is impedance matched and amplitude adjusted to make it reach a level suitable for related operations, that is, the maximum value is not saturated.
[0037] To address waveform distortion caused by noise and nonlinearity during signal propagation, cross-correlation is performed on the transmitted and received waveform sequences to capture the discrete offset index when they are most similar. Then, a cosine interpolation algorithm is used to correct the discrete sampling error, resulting in a precise sub-sampling level time offset value, which accurately quantifies the timing deviation caused by waveform distortion.
[0038] The discrete offset index is combined with the subsampling offset value and converted into a time-compensated value. This value is then used to calibrate the coarse value obtained by the thresholding method, ultimately yielding the first flight time that approximates the true propagation time.
[0039] As an optional embodiment, converting an ultrasonic signal into a received electrical signal includes: receiving an echo signal corresponding to the ultrasonic signal; performing an acoustic-to-electrical conversion on the echo signal to obtain an initial electrical signal; determining an amplification factor based on the output amplitude of the initial electrical signal, and performing a first amplification operation on the initial electrical signal according to the amplification factor; filtering the initial electrical signal after the first amplification operation; and performing a second amplification operation on the filtered initial electrical signal according to the amplification factor to obtain a received electrical signal.
[0040] The second transducer receives the echo signal emitted by the first transducer and propagated through a medium (such as air in a mine tunnel), which corresponds to the original ultrasonic signal.
[0041] The second transducer, as an integrated ultrasonic probe (frequency 40kHz), can convert acoustic signals into electrical signals, transforming the received ultrasonic echo signal in the form of mechanical vibration into an initial electrical signal in the form of voltage.
[0042] The output amplitude of the initial electrical signal is acquired in real time, and the appropriate amplification factor is dynamically determined based on the amplitude. By dynamically adjusting the amplification factor, the processed signal can be kept within the optimal acquisition range, avoiding the effective signal being masked by noise due to too small an amplitude, or the signal saturation and distortion due to too large an amplitude.
[0043] The initial electrical signal is input into the programmable operational amplifier, and the initial electrical signal is amplified for the first time according to the appropriate amplification factor, which initially increases the signal amplitude and provides a clearer signal basis for filtering processing.
[0044] The initial electrical signal after the first amplification operation is filtered to remove irrelevant noise such as medium interference and circuit noise, while retaining the effective signal components related to the ultrasonic signal and reducing noise interference.
[0045] The filtered electrical signal is then input into the programmable operational amplifier for a second amplification according to the appropriate amplification factor, so that the signal amplitude is within a preset range (such as to meet the threshold judgment requirements of the comparator). This application does not specifically limit the preset range.
[0046] This application does not rely on fixed signal amplitude conditions. It can dynamically adjust the gain amplification factor according to the signal amplitude changes caused by complex environments such as airflow fluctuations and signal propagation attenuation in mine roadways. It can adapt to the environmental differences of different mines and roadways, thus improving the practicality and environmental adaptability of ultrasonic time-of-flight measurement methods.
[0047] As an optional embodiment, waveform matching analysis is performed on the transmitted waveform sequence and the received waveform sequence to obtain the time offset value of the received waveform sequence relative to the transmitted waveform sequence. This includes: calculating the cross-correlation function of the transmitted waveform sequence and the received waveform sequence to obtain a cross-correlation sequence; determining the maximum value in the cross-correlation sequence and determining the index position corresponding to the maximum value; obtaining the target cross-correlation value at two positions adjacent to the index position, wherein the target cross-correlation value includes the cross-correlation value before the index position and the cross-correlation value after the index position; and performing cosine interpolation on the maximum value and the target cross-correlation value to obtain the time offset value.
[0048] Transmitted waveform sequence (denoted as tx[0]...tx[max]) and the received waveform sequence (denoted as rx[0]...rx[max]) is the input, n is the sampling point index of the sequence, (nm) represents the offset index of the received waveform sequence relative to the transmitted waveform sequence, and m is the offset parameter.
[0049] The cross-correlation function between the two is calculated using the cross-correlation formula, and the corresponding cross-correlation sequence is output (denoted as ). This operation can quantify the similarity between two waveform sequences at different time offsets. The larger the cross-correlation value, the higher the waveform similarity at the corresponding offset.
[0050] Traversing cross-correlation sequences Filter out the maximum value in the sequence (i.e., the maximum cross-correlation value) and record the offset index position corresponding to the maximum value (denoted as m'), that is, m' = argmax( The index position m' corresponds to the coarse time offset index of the received waveform sequence relative to the transmitted waveform sequence, reflecting the approximate offset relationship when the two waveforms are most similar.
[0051] By index position Based on this, the cross-correlation values of its two adjacent positions are extracted as the target cross-correlation value, specifically including ( The cross-correlation value corresponding to the position (denoted as ) )and( The cross-correlation value corresponding to the position (denoted as ) .
[0052] Based on maximum value Cross-correlation value with two targets , The precise time offset (denoted as δ) is calculated using a cosine interpolation algorithm, specifically including: Calculate an interpolation parameter : , Calculate another interpolation parameter : , Calculate the final time offset value δ: .
[0053] It should be noted that the time offset value δ is the precise offset of the index dimension, not the offset of the time dimension.
[0054] Since the transmitted and received waveform sequences are discrete signals acquired by the AD (Analog-to-Digital) unit, the index m' corresponding to the maximum value of the cross-correlation sequence is a discrete integer, which cannot accurately correspond to the maximum similarity offset point of the real continuous signal (i.e., there is discrete error). The cosine interpolation algorithm fits a continuous cross-correlation curve by using the cross-correlation values of adjacent positions of the maximum value, and then finds the offset δ of the true extreme point of the curve relative to the discrete index m', realizing the correction from discrete index offset to continuous accurate offset, thus overcoming the accuracy limitation caused by discrete sampling.
[0055] This application only performs interpolation operations on the maximum value and two adjacent points in the cross-correlation sequence, without the need for complex processing of the entire cross-correlation sequence. Compared with the traditional full-sequence fine matching method, it significantly reduces the amount of computation. At the same time, it retains the advantages of cross-correlation method in terms of anti-interference and accurate waveform matching, achieving a balance between high precision and high efficiency, and avoiding excessive hardware resource consumption.
[0056] As an optional embodiment, the count value is corrected using a time offset value to obtain the first flight time of the ultrasonic signal from the first transducer to the second transducer, including: obtaining the number of sampling points corresponding to the index position; adding the number of sampling points to the time offset value to obtain the total offset value; obtaining the sampling frequency when the waveform is acquired, and dividing the total offset value by the sampling frequency to obtain the time compensation value; subtracting the time compensation value from the count value to obtain the first flight time from the first transducer to the second transducer.
[0057] Extract the index position m' corresponding to the maximum value of the cross-correlation sequence obtained from the waveform matching analysis. This index position m' is the discrete sampling point offset index of the received waveform sequence relative to the transmitted waveform sequence, which directly corresponds to the number of sampling points in the discrete domain (i.e., the number of offset points of the received waveform relative to the transmitted waveform in the sampling sequence).
[0058] The number of sampling points m' is added to the time offset value δ obtained by cosine interpolation to obtain the total offset value (denoted as (m'+δ)), where δ is the precise offset at the sub-sampling point level. This addition operation is used to achieve offset quantization.
[0059] The sampling frequency (denoted as sample_rate, in Hz) of the AD (Analog-to-Digital) unit when acquiring the transmitted and received waveform sequences is obtained. The sampling frequency is a preset hardware acquisition parameter that reflects the number of signal samples per unit time.
[0060] Divide the total offset value (m'+δ) by the sampling frequency sample_rate to obtain the time compensation value. The calculation formula is as follows: .
[0061] The time compensation value is the deviation in the count value caused by waveform distortion, and the unit is seconds (s).
[0062] The correction process relies solely on the preset hardware parameter of sampling frequency, requiring no adjustment of additional hardware structure. It can adapt to AD units with different sampling frequencies and is compatible with the hardware configurations of various ultrasonic measuring devices, thus enhancing the applicability and portability of the correction method.
[0063] Subtracting the time compensation value from the count value t acquired by the threshold trigger (i.e., the time difference between the transmitted and received electrical signals reaching the threshold, a rough value of the flight time) yields the first flight time of the ultrasonic signal from the first transducer to the second transducer (denoted as t). The calculation formula is: .
[0064] By combining sampling point offset with full offset quantization and time conversion of subsampling point offset, the count value deviation caused by waveform distortion is accurately captured, and the coarse value obtained by the threshold method is corrected to the high-precision true flight time, which solves the problem of insufficient measurement accuracy caused by the traditional threshold method not considering waveform distortion.
[0065] The entire correction process involves only basic addition, subtraction, multiplication, and division operations, without the need for complex signal processing or iterative calculations. While retaining the advantage of low computational complexity of the threshold method, it achieves improved accuracy, avoids consuming too much CPU (Central Processing Unit) resources, and ensures real-time measurement.
[0066] As an optional embodiment, after obtaining the first flight time, the method further includes calculating the current wind speed in the following manner: calculating the second flight time of the ultrasonic signal from the second transducer to the first transducer; performing correlation calculations based on the two received waveforms (clockwise and counterclockwise), and adding the difference between the two minimum flight times (clockwise and counterclockwise) to obtain the bidirectional flight time difference; determining the path length and path direction between the first transducer and the second transducer, and determining the angle between the path direction and the current wind direction; and calculating the current wind speed based on the bidirectional flight time difference, the path length, and the angle.
[0067] Using the same measurement method as the first flight time, a drive signal is applied to the second transducer to cause it to emit an ultrasonic signal; a counter is started and the emitted waveform sequence is recorded; after waiting for the minimum flight time, the timer count value and the received waveform sequence are acquired; the time offset value is obtained through waveform matching analysis and used to correct the count value, finally obtaining the second flight time of the ultrasonic signal from the second transducer to the first transducer (denoted as ). ).
[0068] According to the first flight time With the second flight time The two-way time-of-flight difference is obtained through interpolation. However, since both flight times may contain errors, the calculation can amplify the error. Therefore, this two-way time-of-flight difference is used as a verification condition. That is, the correlation operation of the two received waveforms is used to calculate the time-of-flight difference, and it is then compared with the two-way time-of-flight difference = | – By comparison, if the error is within the allowable range, the data is valid; if the two are inconsistent, the data is discarded. Ultimately, this difference directly reflects the influence of wind direction and wind speed on the propagation time of ultrasonic waves.
[0069] The path length (denoted as L) is the straight-line distance between the first transducer and the second transducer, which is a fixed hardware parameter preset during system installation (such as the spacing between transducers installed in a mine roadway).
[0070] The path direction is a straight line from the first transducer to the second transducer.
[0071] The included angle (denoted as θ) is the angle between the path direction and the current wind direction, which is determined by the transducer installation layout and is a preset installation parameter.
[0072] Substituting the two-way flight time difference, path length L, and included angle θ into the wind speed calculation formula, we obtain the current wind speed (denoted as V), as follows: .
[0073] like < If the signal is emitted from the first transducer to the second transducer, it indicates that the propagation is in the downwind direction, and the propagation is against the wind direction. The calculated result V is positive and can directly represent the current wind speed.
[0074] Figure 6The diagram provided in this application shows a wind speed measurement. In the diagram, "Upwind 1#" and "Downwind 2#" are a pair of ultrasonic transceiver transducers (frequency 40kHz) installed in opposite directions. "Upwind 1#" is the first transducer, and "Downwind 2#" is the second transducer. The two are fixedly installed in the mine roadway. The straight-line distance between them is the path length L, and the vertical height is H. "v to be determined" is the wind speed direction in the roadway to be measured, and θ is the angle between the transducer connection line (ultrasonic propagation path) and the wind direction, which is determined by the installation position (e.g., θ=0° when installed in the downwind direction).
[0075] Ultrasonic wave propagation is affected by wind direction. When propagating with the wind (1#→2#), the airflow assists in shortening the propagation time (denoted as ). When propagating against the wind (2#→1#), airflow obstruction prolongs the propagation time (denoted as ). Based on the time difference between the two, and combined with the geometric correction of path length L and angle θ (cosθ corrects for the angle between wind direction and propagation path), the formula is used to... The actual wind speed is calculated, realizing the conversion from ultrasonic flight time difference to wind speed.
[0076] For example, the method for calculating one-way flight time includes the following two stages: Coarse value acquisition stage: The first transducer emits ultrasonic waves, simultaneously activating the timing module. The signal is coupled to the receiving module, amplified and filtered by a programmable operational amplifier, and then acquired by an AD converter to obtain the transmitted waveform sequence. While waiting for the minimum flight time, the count value is recorded, and the receiving sequence acquisition begins simultaneously. The period from counter startup to the end of the minimum flight time is the coarse value of the flight time.
[0077] Precise correction stage: Cross-correlation is performed on the tx transmit sequence and the rx receive sequence to find the offset index m' corresponding to the maximum cross-correlation value, reflecting the coarse time offset of the transmit and receive waveforms; then cosine interpolation is performed on the cross-correlation values adjacent to m' to obtain the subsampling offset δ, correcting the error of discrete sampling; finally, the error is corrected using the formula... (sample_rate is the AD sampling frequency), the offset is converted into a time compensation value, and the accurate flight time is obtained after correcting for t. This solves the measurement error problem caused by noise and waveform distortion.
[0078] By collecting flight times in both the headwind and headwind directions, the influence of fixed system errors such as the reference propagation speed of ultrasound in still air and transducer response delay on the calculation results can be offset. Only the time difference signal caused by wind speed is retained. Compared with the unidirectional measurement method, this significantly improves the accuracy of wind speed calculation and is suitable for scenarios with strict requirements for measurement accuracy, such as mine ventilation. Moreover, the path length and included angle are preset parameters during system installation, eliminating the need for additional real-time measurements. Wind speed calculation only involves basic arithmetic operations and trigonometric function operations, resulting in low computational complexity.
[0079] This application provides a method for measuring ultrasonic time of flight, comprising: obtaining the resultant velocity of ultrasonic transmission based on the transducer installation distance and the wind direction (headwind and tailwind), and then obtaining the minimum flight time. The absolute and relative flight times of the ultrasonic waves under tailwind and headwind conditions are then calculated. The uplink absolute flight time measurement method is as follows: a drive signal is applied to the downwind transducer to cause it to emit an ultrasonic signal corresponding to the drive signal; a timer is started and the transmitted waveform sequence of the transmitted electrical signal is acquired; after the counter reaches the minimum flight time, the received waveform sequence is acquired, and waveform matching analysis is performed on the transmitted and received waveform sequences to obtain the time offset of the received waveform sequence relative to the transmitted waveform sequence. This offset is then added to the minimum flight time recorded by the counter to obtain the uplink absolute flight time. Similarly, the downlink absolute flight time can be obtained by switching the transducer using a switching circuit. The relative flight time calculation method is as follows: correlation calculations are performed on the uplink and downlink received waveforms to obtain the time difference between the two received waveforms. This time difference is then added to the minimum flight time difference between the uplink and downlink to obtain the relative flight time. By obtaining the absolute and relative flight times, the wind speed can be calculated. This solves the problem of balancing measurement accuracy and computational efficiency when measuring ultrasonic time-of-flight.
[0080] According to another aspect of the embodiments of this application, this application provides an ultrasonic time-of-flight measuring device, such as... Figure 7As shown, the system includes a processing module 401, a transmitting module 402, a receiving module 403, a transmit / receive switching module 404, a first transducer 405, a second transducer 406, a timing module 407, and an analog-to-digital conversion module 408. The processing module sends control commands to the transmitting module and the transmit / receive switching module. The transmitting module generates a drive signal upon receiving the control command. The transmit / receive switching module routes the drive signal to the first transducer to transmit an ultrasonic signal in the transmitting state, and routes the echo signal received by the second transducer to the receiving module in the receiving state, upon receiving the control command. The receiving module conditions the echo signal and outputs a received electrical signal. The analog-to-digital conversion module is used for… The system acquires transmitted electrical signals from the transmitting module and received electrical signals from the receiving module, and sends the acquisition results to the processing module. The transmitted electrical signals are obtained by coupling them into the drive signal. The acquisition results include the transmitted waveform sequence and the received waveform sequence. The timing module records the start time, end time, minimum flight time arrival time, and received waveform convergence time of the transmitted electrical signals, and transmits the timing values to the processing module. The processing module also performs waveform matching analysis on the transmitted and received waveform sequences to obtain the time offset value, and calculates the first flight time of the ultrasonic signal between the first and second transducers based on the timing value and the time offset value.
[0081] The processor is configured to send control commands to the transmitting module and the transceiver switching module through its control interface to coordinate the switching of the ultrasonic wave transmission and reception states.
[0082] For example, the processor controls the transmitting module by sending an "ignition" command through the I / O port. The processor controls the switching module by sending a "state switch" command (transmit state / receive state) through the I / O port.
[0083] The analog-to-digital conversion module includes a first acquisition channel and a second acquisition channel. The first acquisition channel is used to acquire the drive signal or its coupling signal (i.e., the transmitted electrical signal) from the transmitting module as the transmitted electrical signal. The second acquisition channel is used to acquire the received electrical signal from the receiving module.
[0084] As an optional embodiment, the receiving module includes a programmable gain amplifier and a bandpass filter. The programmable gain amplifier is used to dynamically adjust the amplification factor of the echo signal so that the amplitude of the output received electrical signal is within a preset range. The bandpass filter is used to filter the amplified echo signal to suppress noise.
[0085] The amplitude of the echo signal varies drastically due to factors such as propagation distance, medium attenuation, and differences in transducer sensitivity. Based on the real-time amplitude of the echo signal, its gain factor (corresponding amplification factor) is dynamically adjusted by an internal or external controller.
[0086] This application enables automatic gain control, which aims to normalize a large-scale input signal to a stable amplitude range suitable for subsequent circuit processing, avoiding the signal being too weak and overwhelmed by noise, or too strong and causing saturation distortion in the subsequent circuit.
[0087] The signal, after its gain has been initially stabilized, is fed into a bandpass filter whose center frequency is precisely matched to the ultrasonic transmission frequency (e.g., 40kHz). The main function of this filter is frequency-selective filtering, which allows signal components (useful signals) with the same transmission frequency to pass through efficiently, while strongly attenuating out-of-band noise, such as low-frequency power frequency interference, environmental vibration noise, and high-frequency circuit switching noise, thus significantly improving the signal-to-noise ratio.
[0088] As an optional embodiment, the first transducer and the second transducer are arranged opposite each other with a preset distance and a preset angle. The preset distance is the straight-line distance between the first transducer and the second transducer, and the preset angle is the angle between the direction of the straight-line distance and the current wind direction.
[0089] Defining and fixing the transducer installation spacing L and the included angle θ has the core benefit of transforming the complex velocity vector measurement into a scalar measurement problem that can be accurately mathematically modeled and defined by fixed geometric parameters. The known L and θ are substituted into the formula as system constants, giving the final wind speed calculation result a definite physical meaning and traceable accuracy.
[0090] This arrangement of the first and second transducers forms the theoretical basis for achieving time-difference measurement and eliminating the absolute value of sound velocity. Furthermore, by appropriately setting θ (e.g., 45° or 60°), an optimal balance can be achieved between measurement sensitivity and ease of installation.
[0091] Figure 8 The schematic diagram of the ultrasonic time-of-flight acquisition circuit provided in this application uses an STM32 processor as the control core, and in conjunction with a transducer, a transceiver switching module, a counting unit, and an AD (Analog-to-Digital) unit, realizes the transmission and reception of ultrasonic signals and the acquisition of basic time-of-flight data. The specific principle is as follows: 1. Signal transmission control: The STM32 processor generates a drive signal (40kHz continuous PWM (Pulse Width Modulation Square Wave)) and transmits it to transducer 1 through one or more of its IO pins (Input / Output Pins); at the same time, the signal is coupled to the receiving module to provide a synchronization reference for subsequent timing start and waveform acquisition.
[0092] 2. Transmit / Receive Switching Logic: The function switching between transducers 1 and 2 is achieved through the "transmit / receive switching" module. During the transmission phase, the switching module directs the drive signal output by the processor to transducer 1, enabling it to emit ultrasonic waves; during the reception phase, the switching module directs the echo signal received by transducer 2 to the receiving module, avoiding mutual interference between the transmitted and received signals.
[0093] 3. Timing and Waveform Acquisition: The receiving module processes the coupled transmission synchronization signal, triggering the counting unit to start timing; simultaneously, the AD unit is activated to acquire the transmitted signal waveform, generating the transmitted waveform sequence (tx[0]...tx[max]). When transducer 2 receives the ultrasonic wave and converts it into an electrical signal, the receiving module processes the signal, triggering the counting unit to stop timing, and the AD unit synchronously acquires the received waveform sequence (rx[0]...rx[max]), ultimately obtaining the coarse value of the flight time (count value t) and the transmitted and received waveform data, providing a hardware foundation for high-precision flight time calculation.
[0094] According to another aspect of the embodiments of this application, this application provides an electronic device, such as... Figure 9 As shown, the system includes a memory 601, a processor 603, a communication interface 605, and a communication bus 607. The memory 601 stores a computer program that can run on the processor 603. The memory 601 and the processor 603 communicate through the communication interface 605 and the communication bus 607. When the processor 603 executes the computer program, it implements the steps of the above method.
[0095] The memory and processor in the aforementioned electronic devices communicate with each other via a communication bus and a communication interface. The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0096] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0097] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0098] According to another aspect of the embodiments of this application, a computer-readable medium having processor-executable non-volatile program code is also provided.
[0099] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.
[0100] In specific implementation, the embodiments of this application can be referred to the above embodiments and have corresponding technical effects.
[0101] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.
[0102] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0103] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0104] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0105] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0106] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0107] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0108] If the aforementioned function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks. It should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. In the absence of further restrictions, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0109] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. 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 this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method of measuring the time of flight of an ultrasonic wave, characterized in that, include: A drive signal is applied to the first transducer to cause the first transducer to emit an ultrasonic signal corresponding to the drive signal; Start the timer and acquire the transmitted waveform sequence of the transmitted electrical signal; Based on the transducer installation distance, the minimum flight time is calculated using the combined velocity of sound and wind speed, and is used as a rough value for the absolute flight time. After waiting for the minimum flight time to end, the count value of the timer and the received waveform sequence of the received electrical signal are collected, wherein the amplitude of the received electrical signal is within a preset range; Perform waveform matching analysis on the transmitted waveform sequence and the received waveform sequence to obtain the time offset value of the received waveform sequence relative to the transmitted waveform sequence; The time offset value is used to correct the coarse flight time to obtain the first absolute flight time of the ultrasonic signal from the first transducer to the second transducer. By switching the transceiver transducer using a switching circuit, the second absolute time of flight after the switch can be obtained. Waveform matching is performed on the first time-of-flight received waveform and the second time-of-flight received waveform to calculate the offset time, which is used to correct the difference between the first minimum time of flight and the second minimum time of flight, thus obtaining the relative time of flight.
2. The method of claim 1, wherein, The step of converting the ultrasonic signal into a received electrical signal includes: Receive the echo signal corresponding to the ultrasonic signal; The echo signal is converted from sound to electricity to obtain an initial electrical signal; The amplification factor is determined based on the output amplitude of the initial electrical signal, and the initial electrical signal is amplified in accordance with the amplification factor. The initial electrical signal after the first amplification operation is filtered. The initial electrical signal, after being filtered, is amplified a second time according to the amplification factor to obtain the received electrical signal.
3. The method of claim 1, wherein, The step of performing waveform matching analysis on the transmitted waveform sequence and the received waveform sequence to obtain the time offset value of the received waveform sequence relative to the transmitted waveform sequence includes: Calculate the cross-correlation function between the transmitted waveform sequence and the received waveform sequence to obtain the cross-correlation sequence; Determine the maximum value in the cross-correlation sequence, and determine the index position corresponding to the maximum value; Obtain the target cross-correlation values at two positions adjacent to the index position, wherein the target cross-correlation values include the cross-correlation value before the index position and the cross-correlation value after the index position; The time offset value is obtained by cosine interpolation of the maximum value and the target cross-correlation value.
4. The method of claim 3, wherein, The step of correcting the coarse flight time using the time offset value to obtain the first flight time of the ultrasonic signal from the first transducer to the second transducer includes: Obtain the number of sampling points corresponding to the index position; Add the number of sampling points to the time offset value to obtain the total offset value; The sampling frequency during waveform acquisition is obtained, and the total offset value is divided by the sampling frequency to obtain the time compensation value; The first flight time from the first transducer to the second transducer is obtained by adding the coarse flight time value to the time compensation value.
5. The method of claim 1, wherein, After obtaining the first flight time, the method further includes calculating the current wind speed in the following manner: calculating a second time of flight of the ultrasonic signal from the second transducer to the first transducer; calculating a two-way time of flight difference according to the first time of flight and the second time of flight; determining a path length and a path direction between the first transducer and the second transducer, and determining an included angle between the path direction and a current wind direction; calculating the current wind speed according to the two-way time of flight difference, the path length, and the included angle.
6. An ultrasonic time-of-flight measuring device, characterized in that The processing module, the transmitting module, the receiving module, the transceiver switching module, the first transducer, the second transducer, the timing module, and the analog-to-digital conversion module are included. The processing module is configured to send a control instruction to the transmitting module and the transceiver switching module. The transmitting module is configured to generate a driving signal upon receiving the control instruction. The transceiver switching module is configured to route the driving signal to the first transducer in a transmitting state to transmit an ultrasonic signal, and route a received echo signal received by the second transducer to the receiving module in a receiving state. The receiving module is configured to process the received echo signal and output a received electrical signal. The analog-to-digital conversion module is configured to collect a transmitting electrical signal from the transmitting module and the received electrical signal from the receiving module, and send the collection results to the processing module, wherein the transmitting electrical signal is coupled from the driving signal, and the collection results include a transmitting waveform sequence of the transmitting electrical signal and a received waveform sequence of the received electrical signal. The timing module is configured to record a transmitting signal start time, a transmitting signal end time, a minimum time of flight arrival time, and a received waveform end time, and transmit timing values to the processing module. The processing module is further configured to perform waveform matching analysis on the transmitting waveform sequence and the received waveform sequence to obtain a time offset value, and calculate a first time of flight of the ultrasonic signal between the first transducer and the second transducer based on the timing values and the time offset value.
7. The measuring device of claim 6, wherein, The receiving module includes a programmable gain amplifier and a band-pass filter, the programmable gain amplifier is configured to dynamically adjust the amplification of the received echo signal to make the amplitude of the output received electrical signal within a preset range, and the band-pass filter is configured to filter the amplified received echo signal to suppress noise.
8. The measuring device of claim 6, wherein, The first transducer and the second transducer are oppositely arranged at a preset interval and a preset included angle, the preset interval is a straight-line distance between the first transducer and the second transducer, and the preset included angle is an included angle between a direction of the straight-line distance and a current wind direction.
9. An electronic device comprising a memory, a processor, a communication interface and a communication bus, the memory storing a computer program executable on the processor, the memory, the processor communicating through the communication bus and the communication interface, characterized in that, The processor executes the computer program to implement the steps of the method of any one of claims 1 to 5.
10. A computer readable medium having non-transitory program code executable by a processor, the program code comprising instructions for: The program code causes the processor to execute the method of any one of claims 1 to 5.