Flow measurement method, system and device of ultrasonic flowmeter based on FPGA (Field Programmable Gate Array)
Through FPGA technology combining time digital conversion and cross-correlation method, the problems of slow signal processing speed and low accuracy of traditional ultrasonic flowmeters are solved, and multi-channel synchronous measurement and high-precision flow measurement are realized to adapt to complex environments.
Patent Information
- Application Number
- CN202510816210.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-08-08
AI Technical Summary
Traditional ultrasonic flowmeters are limited by the pseudo-parallel signal processing logic of microprocessors, resulting in slow signal processing speed, and the use of TDC zero crossing method in complex noise environments leads to unreliable signal processing accuracy.
The ultrasonic flowmeter based on FPGA is used to obtain the downstream and countercurrent echo signals, and the zero-crossing comparator and analog-to-digital converter are used to calculate the fluid flow velocity value by combining the time digital conversion method and the cross-correlation method, and to achieve multi-channel synchronous measurement and noise immunity through risk coefficient evaluation and weight coefficient adjustment.
Signal processing speed and accuracy are significantly improved, adapted to different fluid media and environments, reduced power consumption, and improved measurement accuracy in complex noise environments.
Smart Images

Figure CN120446530A_ABST
Abstract
Description
Technical Field
[0001] Multiple embodiments of this specification relate to the technical field of flow measurement of ultrasonic flowmeters, and particularly to optimizing the signal processing speed and accuracy of ultrasonic flowmeters. Background Art
[0002] Ultrasonic flowmeters, a key solution for non-contact flow measurement, are based on the propagation characteristics of ultrasonic waves in fluids. When ultrasonic waves propagate downstream and upstream of a flowing medium, their propagation time varies depending on the fluid velocity. By accurately measuring this time difference, the fluid velocity can be inferred. Due to their advantages such as zero pressure drop, wide rangeability, and ability to measure corrosive media, ultrasonic flowmeters have gained a core position in the oil and gas, municipal water supply, and chemical industries.
[0003] Traditional ultrasonic flow meters process signals through a microprocessor (MCU / DSP). Typical implementations rely on an external time-to-digital converter (TDC) chip to record the time interval between the transmitted pulse and the zero crossing of the received signal, thereby obtaining the flight time to calculate the flow velocity.
[0004] However, on the one hand, the use of microprocessors to process signals has the problems of slow processing speed and long calculation cycle. Since the microprocessor is a sequential execution processor, its inherent defect of serial processing makes it difficult to achieve multi-channel rapid synchronous measurement. Moreover, although the dynamic power consumption of the microprocessor is low, the long processing time results in a high total energy consumption. In addition, there is also the problem of difficulty in selecting the microprocessor. On the other hand, the flow calculation based on the TDC zero-crossing method has poor anti-interference ability in complex noise environments. Due to the influence of various factors such as turbulence, impurities, pipeline vibration, valve switching, and pressure regulation, the received ultrasonic echo signal will undergo irregular changes, affecting the measurement accuracy. Summary of the Invention
[0005] The embodiments of this specification provide a flow measurement method, system, and device for an FPGA-based ultrasonic flowmeter, which solves the problem of slow signal processing speed caused by the pseudo-parallel signal processing logic of the microprocessor in traditional ultrasonic flowmeters, and the problem of unreliable signal processing accuracy caused by the use of the TDC zero-crossing method in complex noisy environments.
[0006] The technical solution is as follows: In a first aspect, an embodiment of this specification provides a flow velocity measurement method of an ultrasonic flow meter based on an FPGA, comprising the following steps: Obtaining a set of downstream echo signals and upstream echo signals for calculating fluid flow velocity values; Obtaining a downstream square wave signal corresponding to the downstream echo signal and an upstream square wave signal corresponding to the upstream echo signal by a zero-crossing comparator, and obtaining a first time of flight based on the downstream square wave signal and the upstream square wave signal using a time-to-digital conversion method; Obtaining, by an analog-to-digital converter, a downstream sampling signal corresponding to the downstream echo signal and an upstream sampling signal corresponding to the upstream echo signal, and obtaining a second time of flight based on the downstream sampling signal and the upstream sampling signal using a cross-correlation method; Calculating a first risk coefficient corresponding to the first flight time and a second risk coefficient corresponding to the second flight time based on the downstream echo signal and the upstream echo signal; A target flight time is obtained based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient to calculate the fluid flow rate value.
[0007] As a preferred solution, the step of obtaining the target flight time based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient to calculate the fluid flow rate value includes: When the first risk coefficient is greater than a first preset value and the second risk coefficient is greater than a second preset value, obtaining weight coefficients corresponding to the first flight time and the second flight time respectively based on the first risk coefficient and the second risk coefficient; The target flight time is obtained based on the first flight time, the second flight time and the corresponding weight coefficients to calculate the fluid flow rate value.
[0008] As a preferred solution, it also includes: When the first risk coefficient is less than or equal to the first preset value and greater than the third preset value and the second risk coefficient is less than or equal to the second preset value and greater than the fourth preset value, the fluid flow rate value is calculated using the second flight time as the target flight time.
[0009] As a preferred solution, the method of obtaining the first flight time based on the downstream square wave signal and the upstream square wave signal using a time-to-digital conversion method includes: Obtaining the transmission time of the transmission pulses corresponding to the downstream echo signal and the upstream echo signal; Based on the transmission time of the downstream square wave signal, the upstream square wave signal, and the transmission pulses corresponding to the downstream echo signal and the upstream echo signal, a high-frequency clock counter is used to measure the first clock cycle number corresponding to the downstream echo signal and the second clock cycle number corresponding to the upstream echo signal; Based on the transmission time of the downstream square wave signal, the upstream square wave signal, and the transmission pulses corresponding to the downstream echo signal and the upstream echo signal, a delay chain is used to measure a first phase difference value corresponding to the downstream echo signal and a second phase difference value corresponding to the upstream echo signal; The first flight time is acquired based on the clock cycle of the high-frequency clock counter, the first clock cycle number and the first phase difference corresponding to the downstream echo signal, and the second clock cycle number and the second phase difference corresponding to the upstream echo signal.
[0010] As a preferred solution, the delay chain includes multiple parallel delay sub-chains; and using the delay chain to measure the first phase difference corresponding to the downstream echo signal and the second phase difference corresponding to the upstream echo signal includes: Obtain the measurement results corresponding to each delay sub-chain; Calculate the standard deviation of each delay subchain based on the measurement results of each delay subchain, and assign a weight to each delay subchain based on the standard deviation, so that the sum of the weights of all delay subchains is 1; A first phase difference value corresponding to the downstream echo signal and a second phase difference value corresponding to the upstream echo signal are obtained based on the measurement results and weights corresponding to each delay sub-chain.
[0011] As a preferred solution, the calculating of a first risk coefficient corresponding to the first flight time and a second risk coefficient corresponding to the second flight time based on the downstream echo signal and the upstream echo signal includes: Obtaining the signal-to-noise ratio and amplitude range corresponding to the downstream echo signal and the upstream echo signal, as well as the similarity between the downstream echo signal and the upstream echo signal; The first risk coefficient is calculated based on the signal-to-noise ratio and amplitude range corresponding to the downstream echo signal and the upstream echo signal, and the second risk coefficient is calculated based on the amplitude range corresponding to the downstream echo signal and the upstream echo signal and the similarity between the downstream echo signal and the upstream echo signal.
[0012] As a preferred solution, the step of obtaining the target flight time and calculating the fluid flow rate value based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient includes: When the signal-to-noise ratios corresponding to the downstream echo signal and the upstream echo signal are both less than a fifth preset value, the fluid flow velocity value is calculated using the first flight time as the target flight time.
[0013] As a preferred solution, it also includes: Obtain the fluid flow velocity values corresponding to the previous set of downstream echo signals and upstream echo signals; The measurement period of the ultrasonic flowmeter is adjusted based on the fluid flow velocity values corresponding to the previous set of downstream echo signals and upstream echo signals.
[0014] In a second aspect, an embodiment of this specification provides a flow rate measurement system for an ultrasonic flow meter based on an FPGA, comprising an acquisition module, a first calculation module, a second calculation module, a risk assessment module, and an output module; The acquisition module acquires a set of downstream echo signals and upstream echo signals for calculating the fluid flow velocity value; The first calculation module obtains a downstream square wave signal corresponding to the downstream echo signal and an upstream square wave signal corresponding to the upstream echo signal by a zero-crossing comparator, and obtains a first flight time based on the downstream square wave signal and the upstream square wave signal using a time-to-digital conversion method; The second calculation module obtains a downstream sampling signal corresponding to the downstream echo signal and an upstream sampling signal corresponding to the upstream echo signal by an analog-to-digital converter, and obtains a second flight time based on the downstream sampling signal and the upstream sampling signal using a cross-correlation method; The risk assessment module calculates a first risk coefficient corresponding to the first flight time and a second risk coefficient corresponding to the second flight time based on the downstream echo signal and the upstream echo signal; The output module obtains the target flight time based on the first flight time, the second flight time, the first risk coefficient and the second risk coefficient to calculate the fluid flow rate value.
[0015] In a third aspect, an embodiment of this specification provides an ultrasonic flowmeter, including an FPGA control unit, a pulse excitation circuit, an echo receiving circuit, a zero-crossing comparison circuit, an analog-to-digital conversion circuit, and a transducer pair connected to the pulse excitation circuit and the echo receiving circuit to transmit and receive ultrasonic signals; The FPGA control unit is connected to the pulse excitation circuit and controls the emission pulse excitation; The zero-crossing comparison circuit and the analog-to-digital conversion circuit are both connected to the echo receiving circuit, the zero-crossing comparison circuit processes the ultrasonic signal received by the echo receiving circuit into a square wave signal, and the analog-to-digital conversion circuit processes the ultrasonic signal received by the echo receiving circuit into a sampling signal; The FPGA control unit is connected to the zero-crossing comparison circuit and the analog-to-digital conversion circuit, and calculates the fluid flow rate value according to the square wave signal output by the zero-crossing comparison circuit and the sampling signal output by the analog-to-digital conversion circuit.
[0016] In a fourth aspect, an embodiment of this specification provides an electronic device comprising a processor and a memory; the processor is connected to the memory; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps described in the first aspect of the above embodiment.
[0017] In a fifth aspect, an embodiment of this specification provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the steps described in the first aspect of the above embodiment.
[0018] The beneficial effects of the technical solutions provided by some embodiments of this specification include at least: FPGA technology enables multi-channel simultaneous measurement, and its parallel computing capabilities significantly improve signal processing speed and accuracy. Its hardware programmability allows for dynamic adjustment of signal processing algorithms to adapt to different fluid media and environments, while its low latency enables high-precision time difference measurement. This overcomes the slow signal processing speed inherent in traditional ultrasonic flowmeters, which is limited by the microprocessor's pseudo-parallel signal processing logic.
[0019] The cross-correlation method has high accuracy and noise resistance but requires a lot of calculation, while the time measurement method is simple to implement but susceptible to noise interference. The fusion calculation of the two methods is used at the same time to achieve complementary defects and achieve the purpose of improving measurement accuracy. It solves the problem of unreliable signal processing accuracy caused by using the TDC zero-crossing method in complex noise environments.
[0020] Due to the insufficient accuracy of a single delay chain and the differences in the delay circuits and logic layout and routing within the FPGA, the characteristics of each delay chain are different. Therefore, a delay chain composed of multiple parallel delay sub-chains can effectively improve the measurement accuracy of time interval measurement.
[0021] The correlation method offers high accuracy and noise immunity but is computationally intensive, while the time measurement method is simple to implement but susceptible to noise interference. Therefore, when external interference is minimal, only the TDC method is used to calculate the time of flight, thereby reducing power consumption.
[0022] Monitor the system flow status in real time and dynamically switch the working mode according to the flow rate range to reduce the power consumption of the whole machine and achieve full utilization of energy. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 This is a flow chart of a flow velocity measurement method of an ultrasonic flowmeter based on FPGA provided in an embodiment of this specification.
[0025] Figure 2 This is a structural diagram of a flow rate measurement system of an ultrasonic flowmeter based on FPGA provided in an embodiment of this specification.
[0026] Figure 3 It is a structural schematic diagram of an ultrasonic flowmeter provided in an embodiment of this specification. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of this specification will be described clearly and completely below in conjunction with the drawings in the embodiments of this specification.
[0028] Throughout this specification, the claims, and the accompanying drawings, the terms "first," "second," "third," and the like are used to distinguish between different items, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may include other steps or elements inherent to the process, method, product, or apparatus.
[0029] The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of this specification. Various examples may appropriately omit, replace, or add various processes or components. For example, the described methods may be performed in an order different from the order described, and various steps may be added, omitted, or combined. Furthermore, features described with respect to some examples may be combined in other examples.
[0030] Reference Figure 1 As shown, Figure 1 A flow chart of a flow velocity measurement method of an ultrasonic flow meter based on an FPGA provided in an embodiment of this specification may include at least the following steps: Step 102: Obtain a set of downstream echo signals and upstream echo signals for calculating fluid flow velocity values; Step 104: Obtain a downstream square wave signal corresponding to the downstream echo signal and an upstream square wave signal corresponding to the upstream echo signal by a zero-crossing comparator, and obtain a first time of flight based on the downstream square wave signal and the upstream square wave signal using a time-to-digital conversion method; Step 106: Obtain, by an analog-to-digital converter, a downstream sampling signal corresponding to the downstream echo signal and an upstream sampling signal corresponding to the upstream echo signal, and obtain a second time of flight based on the downstream sampling signal and the upstream sampling signal using a cross-correlation method; Step 108: Calculate a first risk coefficient corresponding to the first flight time and a second risk coefficient corresponding to the second flight time based on the downstream echo signal and the upstream echo signal; Step 110 : Calculate the fluid flow rate value by obtaining the target flight time based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient.
[0031] Illustratively, hardware-level parallel architectures can overcome the physical limitations of sequential microprocessor execution. FPGA-based ultrasonic flowmeters achieve true parallelism through hardware logic replication, replacing the illusion of "parallelism" created by the microprocessor's single instruction stream hardware under operating system scheduling through rapid switching of execution contexts. In ultrasonic multi-channel scenarios, N independent signal processing chains can be constructed, whereas MCUs / DSPs must simulate pseudo-parallelism through time-division multiplexing and are constrained by a single instruction stream. FPGAs also have abundant internal clock resources, while all MCU operations rely on a master clock. Therefore, the advantages of FPGA technology enable multi-channel synchronous measurement. Its parallel computing capabilities significantly improve signal processing speed and accuracy. Hardware programmability supports dynamic adjustment of signal processing algorithms to adapt to different fluid media and environments. Its low latency enables high-precision time difference measurement.
[0032] Explanatory examples illustrate the implementation of hardware TDC (time-to-digital conversion) functionality within an FPGA. The echo signal passes through a zero-crossing comparator, transforming it into a square wave and inputting it into the FPGA. The FPGA internally reads the precise time delay, and the delay difference between the downstream and upstream echo signals is the first time of flight. The echo signal is sampled by an external analog-to-digital converter (ADC) at high speed, generating two channels of AD data that are then input into the FPGA. The FPGA then performs adaptive signal processing, digital filtering, and calculates the signal envelope. A cross-correlation algorithm is then used to calculate the cross-correlation function of the two processed AD data channels to determine the time difference, thereby determining the specific second time of flight. Dynamic risk factors (first risk factor Ka and second risk factor Kb) are further designed to combine the first and second time of flight to obtain the target time of flight. This enables multi-dimensional verification and adaptive decision-making, significantly improving measurement robustness under complex operating conditions. Finally, the target time of flight is used to calculate the fluid flow rate.
[0033] The core invention of the present invention is that the cross-correlation method has high accuracy and noise resistance but a large amount of calculation, while the time measurement method is simple to implement but susceptible to noise interference. The two are integrated and calculated to complement each other's respective defects and achieve the purpose of improving measurement accuracy.
[0034] Taking into account the problem that the fusion calculation method in the present invention increases the amount of calculation and causes the power consumption of the flow meter to increase, the power consumption of the flow meter is further optimized.
[0035] In one embodiment of the present specification, obtaining a target flight time based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient to calculate a fluid flow rate value includes: When the first risk coefficient is greater than a first preset value and the second risk coefficient is greater than a second preset value, obtaining weight coefficients corresponding to the first flight time and the second flight time respectively based on the first risk coefficient and the second risk coefficient; The target flight time is obtained based on the first flight time, the second flight time and the corresponding weight coefficients to calculate the fluid flow rate value.
[0036] Explanatory, when the risk is low, the flight times calculated by both methods are considered reliable, so the weighted average of the two results (e.g., the weight ratio is 7:3) is used to further improve the measurement accuracy.
[0037] Illustratively, the first preset value and the second preset value can be set as corresponding values for evaluating the risk according to the calculation method of their respective risk coefficients.
[0038] In one embodiment of the present specification, the flow rate measurement method further includes: When the first risk coefficient is less than or equal to the first preset value and greater than the third preset value and the second risk coefficient is less than or equal to the second preset value and greater than the fourth preset value, the fluid flow rate value is calculated using the second flight time as the target flight time.
[0039] Explanatory, when the risk is medium, the second time of flight calculated based on the cross-correlation method is used as the basis for calculating the fluid velocity value, and the calculation results of the TDC method are not fused. In this way, the high precision advantage of the cross-correlation method is used to ensure the accuracy of the velocity measurement and avoid the negative effect of the deviation of the TDC method on the fusion result.
[0040] Illustratively, the third preset value and the fourth preset value can also be set as corresponding numerical values for evaluating the risk according to the calculation method of their respective risk coefficients.
[0041] It should be noted that when the first risk coefficient is less than or equal to the third preset value and the second risk coefficient is less than or equal to the fourth preset value, it indicates that the current state is high risk and the first flight time and the second flight time need to be discarded to avoid outputting distorted fluid flow rate values.
[0042] In one embodiment of the present specification, obtaining a first time of flight based on a downstream square wave signal and an upstream square wave signal using a time-to-digital conversion method includes: Obtaining the transmission time of the transmission pulses corresponding to the downstream echo signal and the upstream echo signal; Based on the transmission time of the downstream square wave signal, the upstream square wave signal, and the transmission pulses corresponding to the downstream echo signal and the upstream echo signal, a high-frequency clock counter is used to measure the first clock cycle number corresponding to the downstream echo signal and the second clock cycle number corresponding to the upstream echo signal; Based on the transmission time of the downstream square wave signal, the upstream square wave signal, and the transmission pulses corresponding to the downstream echo signal and the upstream echo signal, a delay chain is used to measure a first phase difference value corresponding to the downstream echo signal and a second phase difference value corresponding to the upstream echo signal; The first flight time is acquired based on the clock cycle of the high-frequency clock counter, the first clock cycle number and the first phase difference corresponding to the downstream echo signal, and the second clock cycle number and the second phase difference corresponding to the upstream echo signal.
[0043] For clarity, the FPGA has extensive internal clock resources, including PLL frequency multipliers and delay chains, enabling sub-nanosecond time resolution. After the square wave output from the zero-crossing comparator is fed into the FPGA, the FPGA uses a hybrid TDC technology combining clock counting and delay interpolation to accurately read the first time of flight.
[0044] Explanatory, the FPGA system records the emission time t0 of the actual emission pulse. The input downstream square wave signal and upstream square wave signal are first roughly measured using a high-frequency clock counter to obtain an integer number of clock cycles, and then finely measured using a delay chain to obtain the fractional part within the clock cycle of the high-frequency clock counter.
[0045] Specifically, a high-frequency clock (e.g., 500 MHz) drives a counter that counts the number of clock cycles between the start and stop signals. At the start and stop signal edges, a delay chain measures the slight offset relative to the clock edge. The first flight time is calculated as: coarse measurement value * clock cycle + fine measurement value * single-stage delay.
[0046] In one embodiment of the present specification, the delay chain includes a plurality of parallel delay sub-chains; and using the delay chain to measure a first phase difference value corresponding to a downstream echo signal and a second phase difference value corresponding to a downstream echo signal includes: Obtain the measurement results corresponding to each delay sub-chain; Calculate the standard deviation of each delay subchain based on the measurement results of each delay subchain, and assign a weight to each delay subchain based on the standard deviation, so that the sum of the weights of all delay subchains is 1; A first phase difference value corresponding to the downstream echo signal and a second phase difference value corresponding to the upstream echo signal are obtained based on the measurement results and weights corresponding to each delay sub-chain.
[0047] Explanatory note: Due to the limited accuracy of a single delay chain and the differences in delay circuits and logic layout and routing within FPGAs, each delay chain has different characteristics. Therefore, using a single delay chain for measurement, or averaging multiple delay chains, does not meet the required measurement accuracy. Therefore, a delay chain consisting of multiple parallel delay sub-chains is used to effectively improve the accuracy of time interval measurements.
[0048] In one embodiment of the present specification, calculating a first risk coefficient corresponding to a first flight time and a second risk coefficient corresponding to a second flight time based on a downstream echo signal and an upstream echo signal includes: Obtain the signal-to-noise ratio, amplitude range corresponding to the downstream echo signal and the upstream echo signal respectively, and the similarity between the downstream echo signal and the upstream echo signal; Calculate the first risk coefficient based on the signal-to-noise ratio and amplitude range corresponding to the downstream echo signal and the upstream echo signal respectively, and calculate the second risk coefficient based on the amplitude range corresponding to the downstream echo signal and the upstream echo signal respectively and the similarity between the downstream echo signal and the upstream echo signal.
[0049] Illustratively, the magnitude of the first risk coefficient Ka inside the FPGA is mainly determined by the signal-to-noise ratio A1 and amplitude range A2 of the echo signal.
[0050] Exemplarily, when the signal-to-noise ratio A1 > 46 dB, the risk coefficient Ka = 1; when the signal-to-noise ratio 40 dB < A1 ≤ 46 dB, Ka` = 0.9; when the signal-to-noise ratio 30 dB < A1 ≤ 40 dB, Ka` = 0.7; when the signal-to-noise ratio A1 < 33 dB, Ka` = 0.4. The amplitude range A2 takes the amplitude value of the highest peak. Assuming that the maximum signal amplification of the circuit is the maximum amplitude H, when the amplitude range A2 ≥ H, the first risk coefficient Ka = Ka` * 0.9, there is a risk of distortion, but it does not affect the judgment; when 0.5 * H ≤ amplitude range A2 < H, the first risk coefficient Ka = Ka`; when the amplitude range A2 < 0.5 * H, the first risk coefficient Ka = Ka `* 0.8; Illustratively, the magnitude of the second risk coefficient Kb inside the FPGA is mainly determined by the similarity K1 of the echo signal and the amplitude range A2.
[0051] Exemplarily, when the similarity K1 > 95%, Kb` = 1; when the similarity 88% < K ≤ 95%, Kb` = 0.9; when the similarity 75% < K1 ≤ 88%, Kb` = 0.7; when the similarity K1 ≤ 75%, Kb` = 0.4. When the amplitude range A2 ≥ H, the second risk coefficient Kb = Kb` * 0.2, there is a risk of distortion and it is basically discarded; when 0.35 * H < amplitude range A2 < H, the second risk coefficient Kb = Kb`; when the amplitude range A2 ≤ 0.35 * H, the second risk coefficient Kb = Kb `* 0.6.
[0052] In an embodiment of the present specification, obtaining the target flight time to calculate the fluid flow velocity value based on the first flight time, the second flight time, the first risk coefficient and the second risk coefficient includes: When the signal-to-noise ratios corresponding to the downstream echo signal and the upstream echo signal are both less than the fifth preset value, use the first flight time as the target flight time to calculate the fluid flow velocity value.
[0053] For illustrative purposes, external interference factors primarily include electrical interference, such as strong magnetic fields generated by nearby high-power radio transmitters (such as radios, walkie-talkies, and mobile phone base stations), high-current cables (especially inverter output cables), and common-mode interference caused by poor grounding or ground potential differences. These factors can affect echo signal quality. The cross-correlation method effectively suppresses interference factors across different frequency bands, preventing clutter and pulse spikes ahead of the valid signal wave. This results in a high signal-to-noise ratio (SNR) in the TDC scheme, effectively unaffecting similarity. Using the SNR of the echo signal as a measure of external interference, when external interference is minimal, the TDC method alone can be used to calculate the time of flight, eliminating the extensive computational effort of the cross-correlation method and reducing overall power consumption.
[0054] In one embodiment of the present specification, the flow rate measurement method further includes: Obtain the fluid flow velocity values corresponding to the previous set of downstream echo signals and upstream echo signals; The measurement period of the ultrasonic flowmeter is adjusted based on the fluid flow velocity values corresponding to the previous set of downstream echo signals and upstream echo signals.
[0055] For example, the operating modes can be divided into power-saving mode, sleep mode, and full-function mode. When the flow meter system is dynamically measuring and the flow rate reaches zero, the flow meter system enters power-saving mode. The system measurement cycle is extended, from once every 2 seconds to once every 4 seconds, which can greatly reduce the measurement frequency. The system can also set a sleep time period based on actual user usage, allowing the system to enter sleep mode. The system enters sleep mode and waits for a time command or external command to wake up before the system enters operation. The system enters full-function mode and monitors the status of the system flow rate in real time.
[0056] Explanatory, by switching the working mode according to the flow rate range, the power consumption of the whole machine can be dynamically adjusted, and the FPGA dynamic configuration function can be realized to achieve full utilization of energy.
[0057] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0058] See next Figure 2 , Figure 2 A schematic structural diagram of a flow rate measurement system of an ultrasonic flowmeter based on FPGA provided in an embodiment of this specification is shown.
[0059] The flow rate measurement system 200 includes an acquisition module 201, a first calculation module 202, a second calculation module 203, a risk assessment module 204 and an output module 205; An acquisition module 201 acquires a set of downstream echo signals and upstream echo signals for calculating a fluid velocity value; A first calculation module 202 obtains a downstream square wave signal corresponding to the downstream echo signal and an upstream square wave signal corresponding to the upstream echo signal by a zero-crossing comparator, and obtains a first time of flight based on the downstream square wave signal and the upstream square wave signal using a time-to-digital conversion method; The second calculation module 203 obtains a downstream sampling signal corresponding to the downstream echo signal and an upstream sampling signal corresponding to the upstream echo signal by an analog-to-digital converter, and obtains a second flight time based on the downstream sampling signal and the upstream sampling signal using a cross-correlation method; The risk assessment module 204 calculates a first risk coefficient corresponding to the first flight time and a second risk coefficient corresponding to the second flight time based on the downstream echo signal and the upstream echo signal; The output module 205 obtains the target flight time based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient to calculate the fluid flow rate value.
[0060] The various embodiments in this specification are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences from the other embodiments. In particular, the flow velocity measurement system embodiment is generally similar to the flow velocity measurement method embodiment, so its description is relatively simple. For relevant portions, refer to the flow velocity measurement method embodiment.
[0061] See next Figure 3 , Figure 3 A schematic structural diagram of an ultrasonic flowmeter provided in an embodiment of this specification is shown.
[0062] An ultrasonic flowmeter 300 includes an FPGA control unit 301, a pulse excitation circuit 302, an echo receiving circuit 303, a zero-crossing comparison circuit 304, an analog-to-digital conversion circuit 305, and a transducer pair 306 connected to the pulse excitation circuit 302 and the echo receiving circuit 303 to transmit and receive ultrasonic signals; The FPGA control unit 301 is connected to the pulse excitation circuit 302 and controls the emission pulse excitation; The zero-crossing comparison circuit 304 and the analog-to-digital conversion circuit 305 are both connected to the echo receiving circuit 303. The zero-crossing comparison circuit 304 processes the ultrasonic signal received by the echo receiving circuit 303 into a square wave signal, and the analog-to-digital conversion circuit 305 processes the ultrasonic signal received by the echo receiving circuit 303 into a sampling signal. The FPGA control unit 301 is connected to the zero-crossing comparison circuit 304 and the analog-to-digital conversion circuit 305 , and calculates the fluid flow rate value according to the square wave signal output by the zero-crossing comparison circuit 304 and the sampling signal output by the analog-to-digital conversion circuit 305 .
[0063] Working principle: The FPGA control unit 301 controls the pulse excitation circuit 302 to generate a transmit pulse, which causes the transducer pair 306 to transmit and receive an echo. By switching the transducer pair 306's transceiver terminals and transmitting and receiving pulses again, the downstream and upstream echoes are acquired. The echo receiving circuit 303 extracts the downstream and upstream echo signals from the downstream and upstream echoes and outputs them to the zero-crossing comparator circuit 304 and analog-to-digital conversion circuit 305, respectively. The zero-crossing comparator circuit 304 outputs the downstream and upstream echo signals as downstream square wave signals and upstream square wave signals, respectively. The analog-to-digital conversion circuit 305 then outputs the downstream and upstream echo signals as downstream sampling signals and upstream echo signals through an analog-to-digital converter. The FPGA control unit 301 processes the downstream and upstream square wave signals, the downstream sampling signals, and the upstream echo signals to calculate the fluid flow rate.
[0064] The above embodiments are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims of this specification.
Claims
1. A flow velocity measurement method of an ultrasonic flowmeter based on FPGA, characterized in that: The following steps are involved: Obtaining a set of downstream echo signals and upstream echo signals for calculating fluid flow velocity values; Obtaining a downstream square wave signal corresponding to the downstream echo signal and an upstream square wave signal corresponding to the upstream echo signal by a zero-crossing comparator, and obtaining a first time of flight based on the downstream square wave signal and the upstream square wave signal using a time-to-digital conversion method; Obtaining, by an analog-to-digital converter, a downstream sampling signal corresponding to the downstream echo signal and an upstream sampling signal corresponding to the upstream echo signal, and obtaining a second time of flight based on the downstream sampling signal and the upstream sampling signal using a cross-correlation method; Calculating a first risk coefficient corresponding to the first flight time and a second risk coefficient corresponding to the second flight time based on the downstream echo signal and the upstream echo signal; A target flight time is obtained based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient to calculate the fluid flow rate value.
2. The flow velocity measurement method of an ultrasonic flowmeter based on FPGA according to claim 1, characterized in that: The step of obtaining a target flight time based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient to calculate a fluid flow rate value includes: When the first risk coefficient is greater than a first preset value and the second risk coefficient is greater than a second preset value, obtaining weight coefficients corresponding to the first flight time and the second flight time respectively based on the first risk coefficient and the second risk coefficient; The target flight time is obtained based on the first flight time, the second flight time and the corresponding weight coefficients to calculate the fluid flow rate value.
3. The flow velocity measurement method of an ultrasonic flowmeter based on FPGA according to claim 2, characterized in that: Also includes: When the first risk coefficient is less than or equal to the first preset value and greater than the third preset value and the second risk coefficient is less than or equal to the second preset value and greater than the fourth preset value, the fluid flow rate value is calculated using the second flight time as the target flight time.
4. The flow velocity measurement method of an ultrasonic flowmeter based on FPGA according to claim 1, characterized in that: The method of obtaining a first flight time based on a downstream square wave signal and an upstream square wave signal using a time-to-digital conversion method includes: Obtaining the transmission time of the transmission pulses corresponding to the downstream echo signal and the upstream echo signal; Based on the transmission time of the downstream square wave signal, the upstream square wave signal, and the transmission pulses corresponding to the downstream echo signal and the upstream echo signal, a high-frequency clock counter is used to measure the first clock cycle number corresponding to the downstream echo signal and the second clock cycle number corresponding to the upstream echo signal; Based on the transmission time of the downstream square wave signal, the upstream square wave signal, and the transmission pulses corresponding to the downstream echo signal and the upstream echo signal, a delay chain is used to measure a first phase difference value corresponding to the downstream echo signal and a second phase difference value corresponding to the upstream echo signal; The first flight time is acquired based on the clock cycle of the high-frequency clock counter, the first clock cycle number and the first phase difference corresponding to the downstream echo signal, and the second clock cycle number and the second phase difference corresponding to the upstream echo signal.
5. The flow velocity measurement method of an ultrasonic flowmeter based on FPGA according to claim 4, characterized in that: The delay chain includes a plurality of parallel delay sub-chains; and using the delay chain to measure a first phase difference value corresponding to a downstream echo signal and a second phase difference value corresponding to an upstream echo signal includes: Obtain the measurement results corresponding to each delay sub-chain; Calculate the standard deviation of each delay subchain based on the measurement results of each delay subchain, and assign a weight to each delay subchain based on the standard deviation, where the sum of the weights of all delay subchains is 1; A first phase difference value corresponding to the downstream echo signal and a second phase difference value corresponding to the upstream echo signal are obtained based on the measurement results and weights corresponding to each delay sub-chain.
6. The flow velocity measurement method of an ultrasonic flowmeter based on FPGA according to claim 1, characterized in that: The calculating, based on the downstream echo signal and the upstream echo signal, a first risk coefficient corresponding to the first flight time and a second risk coefficient corresponding to the second flight time includes: Obtaining the signal-to-noise ratio and amplitude range corresponding to the downstream echo signal and the upstream echo signal, as well as the similarity between the downstream echo signal and the upstream echo signal; The first risk coefficient is calculated based on the signal-to-noise ratio and amplitude range corresponding to the downstream echo signal and the upstream echo signal, and the second risk coefficient is calculated based on the amplitude range corresponding to the downstream echo signal and the upstream echo signal and the similarity between the downstream echo signal and the upstream echo signal.
7. The flow velocity measurement method of an ultrasonic flowmeter based on FPGA according to any one of claim 6, characterized in that: The step of obtaining a target flight time and calculating a fluid flow rate value based on the first flight time, the second flight time, the first risk coefficient, and the second risk coefficient includes: When the signal-to-noise ratios corresponding to the downstream echo signal and the upstream echo signal are both less than a fifth preset value, the fluid flow velocity value is calculated using the first flight time as the target flight time.
8. The flow velocity measurement method of an ultrasonic flowmeter based on FPGA according to claim 1, characterized in that: Also includes: Obtain the fluid flow velocity values corresponding to the previous set of downstream echo signals and upstream echo signals; The measurement period of the ultrasonic flowmeter is adjusted based on the fluid flow velocity values corresponding to the previous set of downstream echo signals and upstream echo signals.
9. A flow velocity measurement system of an ultrasonic flowmeter based on FPGA, characterized by: It includes an acquisition module, a first calculation module, a second calculation module, a risk assessment module and an output module; The acquisition module acquires a set of downstream echo signals and upstream echo signals for calculating the fluid flow velocity value; The first calculation module obtains a downstream square wave signal corresponding to the downstream echo signal and an upstream square wave signal corresponding to the upstream echo signal by a zero-crossing comparator, and obtains a first flight time based on the downstream square wave signal and the upstream square wave signal using a time-to-digital conversion method; The second calculation module acquires a downstream sampling signal corresponding to the downstream echo signal and an upstream sampling signal corresponding to the upstream echo signal by an analog-to-digital converter, and acquires a second flight time based on the downstream sampling signal and the upstream sampling signal using a cross-correlation method; The risk assessment module calculates a first risk coefficient corresponding to the first flight time and a second risk coefficient corresponding to the second flight time based on the downstream echo signal and the upstream echo signal; The output module obtains the target flight time based on the first flight time, the second flight time, the first risk coefficient and the second risk coefficient to calculate the fluid flow rate value.
10. An ultrasonic flow meter, characterized in that: It includes an FPGA control unit, a pulse excitation circuit, an echo receiving circuit, a zero-crossing comparison circuit, an analog-to-digital conversion circuit, and a transducer pair connected to the pulse excitation circuit and the echo receiving circuit to transmit and receive ultrasonic signals; The FPGA control unit is connected to the pulse excitation circuit and controls the emission pulse excitation; The zero-crossing comparison circuit and the analog-to-digital conversion circuit are both connected to the echo receiving circuit, the zero-crossing comparison circuit processes the ultrasonic signal received by the echo receiving circuit into a square wave signal, and the analog-to-digital conversion circuit processes the ultrasonic signal received by the echo receiving circuit into a sampling signal; The FPGA control unit is connected to the zero-crossing comparison circuit and the analog-to-digital conversion circuit, and calculates the fluid flow rate value according to the square wave signal output by the zero-crossing comparison circuit and the sampling signal output by the analog-to-digital conversion circuit.
Citation Information
Patent Citations
Ultrasonic transit time cross-correlation calculation method based on sliding reference waveform
CN111693732A
High-precision time difference measuring method based on FPGA and cross-correlation method
CN113124948A
Time interval precision measurement method and system based on FPGA (Field Programmable Gate Array)
CN115167093A
Fusion measurement method and system of ultrasonic flowmeter
CN116086555A