Ultrasonic-based oil level measurement method and system
By optimizing ultrasonic oil level measurement through narrow pulse train excitation and dynamic voltage comparison circuit, the problem of insufficient measurement accuracy in oil and gas environments is solved, and highly reliable oil level monitoring is achieved.
Patent Information
- Application Number
- CN202611595520.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-15
- Publication Date
- 2026-11-17
AI Technical Summary
Existing ultrasonic oil level measurement methods suffer from large near-field blind zones and misjudgment of echo trigger time due to transmission ringing tail and echo amplitude attenuation in oil and gas environments, resulting in insufficient measurement accuracy and making it difficult to meet the safety protection requirements of hydropower units.
By employing a narrow pulse train excitation signal, combined with a dynamically configured voltage comparison circuit and an ultrasonic propagation speed corrected for ambient temperature, the signal processing flow is optimized to reduce ringing interference and amplitude attenuation, thereby achieving accurate liquid level measurement.
It effectively shortens the near-field blind zone, reduces false triggering and missed detection, improves measurement accuracy and reliability, and is suitable for the continuous monitoring needs of water, electricity and oil tanks.
Smart Images

Figure CN123111414A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of oil level monitoring technology, and more specifically to an ultrasonic-based oil level measurement method and system. Background Technology
[0002] In the hydropower sector, oil level is a core monitoring parameter for ensuring the safe and stable operation of the equipment. Excessive oil level can easily lead to overflow and heat dissipation failure, while insufficient oil level may result in inadequate oil supply and damage from dry running. Therefore, continuous, accurate, and reliable monitoring of oil level is directly related to production safety and operational efficiency.
[0003] As power plants upgrade towards unmanned and intelligent operation and maintenance, there are stringent requirements for non-contact installation, high reliability, and maintenance-free operation of oil level monitoring, making ultrasonic measurement the mainstream development direction.
[0004] However, directly transplanting the ultrasonic measurement logic of general open water to the scenario of hydroelectric fuel tanks presents significant incompatibility. The effective range of fuel tanks is typically only tens of centimeters. Traditional solutions often use single-pulse or wide-pulse excitation, which can cause the transducer to generate a long-lasting ringing tail. This tail can easily mask the near-field echo, resulting in an excessively large blind zone at low fuel levels, making it difficult to achieve full range coverage. At the same time, fuel tanks are closed environments where oil and gas evaporate. Bubble disturbances can cause the echo amplitude to decrease exponentially with changes in fuel level. Existing equipment generally uses a fixed voltage threshold to capture the echo. Under the combined effects of ringing interference and drastic amplitude fluctuations, near-field false triggering or far-field missed detection is very likely to occur, resulting in a low on-site calibration pass rate.
[0005] In addition, existing solutions often directly apply the formula for the speed of sound in air to calculate the distance to the oil surface, without considering the influence of oil temperature changes and the oil-gas mixture above the oil tank on the speed of sound, which further amplifies the final calculation error and makes it difficult to meet the accuracy level required for unit safety protection. Summary of the Invention
[0006] This invention provides an ultrasonic-based oil level measurement method and system, which solves the technical problems of insufficient measurement accuracy in existing ultrasonic oil level measurement in oil and gas environments, such as transmission ringing tail and severe attenuation of echo amplitude with oil level, large near-field blind zone and misjudgment of echo trigger time when using a fixed threshold.
[0007] This invention is achieved through the following technical solution:
[0008] In a first aspect, this application provides an ultrasonic-based oil level measurement method, comprising the following steps:
[0009] A narrow pulse train excitation signal with a preset frequency is generated, which is then amplified and boosted to drive the ultrasonic transducer to emit ultrasonic waves toward the surface of the oil storage container, and a timing is started simultaneously.
[0010] The echo signal reflected from the liquid surface is received by the transducer. After the peak sampling circuit processes the signal and outputs a millivolt-level voltage signal, the echo signal is subjected to peak sampling processing, and then amplified and filtered in sequence to obtain the shaped echo signal.
[0011] Based on the transducer installation height and the estimated liquid level of the previous cycle, the reference threshold of the voltage comparison circuit is dynamically configured, and the shaped echo signal is compared with the reference threshold. When the signal amplitude exceeds the threshold, an interrupt signal is output to stop the timing, and the ultrasonic round-trip propagation time is obtained.
[0012] Based on the round-trip propagation time and the ultrasonic propagation speed corrected for ambient temperature, the liquid level height is calculated, and the ultrasonic propagation distance and the actual oil level height are finally derived.
[0013] A further optimized solution is that the signal after power amplification and boosting is matched to the resonant drive voltage of the ultrasonic transducer through an impedance matching network and then output to the transducer's transmitting electrode.
[0014] A further optimization scheme is that the dynamic configuration reference threshold specifically includes:
[0015] The current estimated liquid level depth is estimated based on the vertical distance from the transducer mounting reference surface to the bottom of the container and historical liquid level data. The expected echo amplitude is calculated based on the attenuation model of ultrasound in the gaseous medium. The reference voltage of the voltage comparison circuit is adjusted to a preset ratio of the estimated echo peak value.
[0016] A further optimization scheme is that the amplification and filtering processing is analog link processing, and the shaped echo signal is directly input to the voltage comparison circuit without analog-to-digital conversion, and the echo arrival time is directly captured by the external interrupt pin of the microprocessor.
[0017] The further optimized solution also includes the following steps:
[0018] The round-trip propagation time of multiple measurement cycles is continuously acquired. The liquid level height is then calculated after applying a moving average filter to the propagation time. The calculation formula is as follows:
[0019] ;
[0020] Where H is the liquid level height. The vertical distance from the transducer mounting reference surface to the bottom of the container is given by t, the round-trip propagation time is given by c, and the corrected ultrasonic propagation speed is given by c.
[0021] A further optimization is that the corrected ultrasonic wave propagation speed... The following formula is used to calculate:
[0022] ;
[0023] Where T is the ambient temperature and m is the proportional correction coefficient for the oil-gas mixture above the water-electricity-oil tank.
[0024] A further optimization scheme includes an oil level anomaly diagnosis step: if the interruption signal is not detected within a preset number of consecutive times, it is determined to be a transducer malfunction or an oil level exceeding the range, and an alarm signal is output. The preset number of times is configured according to the oil tank operating noise level.
[0025] Secondly, this application provides an ultrasonic-based oil level measurement system, including a microprocessor, a power drive module, an ultrasonic transducer, a peak sampling circuit, a signal conditioning module, and an adaptive threshold comparison circuit.
[0026] The microprocessor is configured to generate a narrow pulse train excitation signal and synchronously start timing, and is also configured to dynamically output a threshold configuration signal based on the estimated liquid level.
[0027] The power drive module is connected between the PWM output terminal of the microprocessor and the transducer, and is used to amplify the power of the pulse train and boost the voltage of the transformer.
[0028] The peak sampling circuit is connected to the echo terminal of the transducer and is used to extract the millivolt-level peak voltage of the echo signal.
[0029] The signal conditioning module includes a preamplifier stage and a filter stage in sequence, and its output is connected to the adaptive threshold comparison circuit.
[0030] The adaptive threshold comparison circuit receives the threshold configuration signal to adjust the reference level, compares the shaped echo signal with the reference level, and outputs an interrupt signal to the external interrupt pin of the microprocessor to stop the timing.
[0031] The microprocessor is also configured to calculate the liquid level height based on timing results combined with temperature-compensated sound velocity.
[0032] A further optimization scheme is that the adaptive threshold comparison circuit is an integrated voltage comparator, and the DAC output or PWM filter output of the microprocessor is connected to the reference voltage pin of the voltage comparator to issue the dynamic reference threshold.
[0033] A further optimization scheme is that the microprocessor is also configured to determine that the transducer is faulty or the oil level is over-range when no interrupt signal is detected from the voltage comparison circuit within a preset number of consecutive cycles, and to output an alarm signal.
[0034] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0035] By generating a narrow pulse train excitation signal to shorten the duration of the transmitted energy, the masking effect of the transducer's inherent ringing tail on the near-field echo is reduced, thus enabling effective reflection signal acquisition conditions in the low oil level range.
[0036] Combined with a reference threshold dynamically configured based on the installation height and the liquid level estimate of the previous cycle, it adapts to the attenuation fluctuation of echo amplitude in the oil and gas environment, reducing false triggering and missed detection of weak echoes in the far field caused by ringing interference.
[0037] By combining the sound velocity parameters corrected for ambient temperature to estimate the liquid level height, the distance deviation introduced by changes in the acoustic characteristics of oil and gas media is reduced, making it suitable for continuous monitoring scenarios of hydroelectric generator oil tanks. Attached Figure Description
[0038] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0039] In the attached image:
[0040] Figure 1 A flowchart illustrating the ultrasonic-based oil level measurement method provided in this application embodiment;
[0041] Figure 2 A flowchart illustrating another method for measuring oil level based on ultrasound, provided in an embodiment of this application;
[0042] Figure 6 This is a schematic diagram of the overall principle of the ultrasonic oil level measurement system provided in the embodiments of this application;
[0043] Figure 3 This is a schematic diagram of the ultrasonic wave transmission and narrow pulse train driving circuit provided in the embodiments of this application;
[0044] Figure 4 This is a schematic diagram of the ultrasonic echo receiving and peak sampling circuit provided in an embodiment of this application;
[0045] Figure 5 The schematic diagram of the echo signal amplification and bandpass filtering circuit provided in the embodiments of this application is shown. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0047] First, some of the technical terms used in this application will be explained to help those skilled in the art understand this application.
[0048] ADC: Analog-to-Digital Converter;
[0049] ATM: Asynchronous Transfer Mode;
[0050] DAC: Digital-to-Analog Converter;
[0051] LM358: Dual operational amplifier;
[0052] MCU: Microcontroller Unit;
[0053] MOSFET: Metal-Oxide-Semiconductor Field-Effect Transistor;
[0054] STM32: STMicroelectronics 32-bit microcontroller.
[0055] Firstly, such as Figures 1-2 As shown, this application provides an ultrasonic-based oil level measurement method, including:
[0056] Step S1: Generate a narrow pulse train excitation signal of a preset frequency, and after power amplification and voltage boosting, drive the ultrasonic transducer to emit ultrasonic waves to the surface of the oil storage container, and start timing simultaneously.
[0057] Step S2: Receive the echo signal reflected from the liquid surface through the transducer, process it through the peak sampling circuit to output a millivolt-level voltage signal, perform peak sampling processing on the echo signal, and then amplify and filter it in sequence to obtain the shaped echo signal.
[0058] Step S3: Based on the transducer installation height and the estimated liquid level of the previous cycle, dynamically configure the reference threshold of the voltage comparison circuit, compare the shaped echo signal with the reference threshold, and output an interrupt signal to stop timing when the signal amplitude exceeds the threshold, thereby obtaining the ultrasonic round-trip propagation time;
[0059] Step S4: Calculate the liquid level height based on the round-trip propagation time and the ultrasonic propagation speed corrected for ambient temperature, and finally calculate the ultrasonic propagation distance and the actual oil level height.
[0060] In one embodiment, step S1: generating a narrow pulse train excitation signal of a preset frequency, which, after power amplification and voltage boosting, drives the ultrasonic transducer to emit ultrasonic waves toward the surface of the oil storage container, and simultaneously starts timing, specifically includes the following steps:
[0061] Step S11: Output a square wave pulse sequence at a preset resonant frequency, adjust the waveform duty cycle to match the transducer excitation characteristics, and obtain the low-voltage pulse train to be amplified.
[0062] Specifically, the STM32 microprocessor generates the square wave pulse through the timer PWM peripheral. The pulse train composed of the square wave pulse is the narrow pulse train excitation signal adapted to the excitation characteristics of the transducer, and is led to the input terminal of the subsequent power amplifier circuit through the I / O pin.
[0063] Specifically, the duty cycle of the square wave pulse is 2%, and the preset resonant frequency is 40kHz. This narrow pulse train not only accurately matches the inherent resonant characteristics of the ultrasonic transducer to ensure transmission sensitivity, but also suppresses the inherent ringing tail of the transducer and compresses the near-field blind zone at low oil levels through the extremely narrow transmission pulse width, thus meeting the requirements for reliable detection of weak echoes in the oil and gas environment of water, electricity and oil tanks.
[0064] Step S12: The low-voltage pulse train is sent to the power amplifier stage for current drive enhancement, and then converted into a high-frequency high-voltage drive signal by the boost converter unit, and output to the transmitting electrode of the ultrasonic transducer.
[0065] Specifically, the boost converter unit uses a transformer to boost the voltage, so that the amplitude of the drive signal matches the resonant operating range of the transducer.
[0066] The power amplification and boosting process described in step S12 is implemented through the following transmitting circuit:
[0067] like Figure 3 As shown, the transmitting circuit adopts an optocoupler isolation and discrete push-pull power amplifier architecture. The low-voltage narrow pulse square wave output by the MCU is electrically isolated from the high voltage by optocoupler P12. Then, the gate of the high-voltage MOSFET (IRF740) is quickly driven by the totem pole pre-driver stage composed of QOC2 / QOC3. When the power transistor is turned on, it outputs a high-voltage spike pulse train to the ultrasonic transducer through the DC blocking capacitor C1. In the figure, the FR107 diodes D1 / D2, together with the current limiting resistor R15, provide a reverse electromotive force freewheeling circuit for the inductive load of the transducer, effectively absorbing the ringing tail after transmission and preventing the power transistor from reverse breakdown. High-energy drive of 40kHz narrow pulse is achieved with low-cost discrete devices, which meets the near-field dead zone suppression and low duty cycle excitation requirements described in the claims.
[0068] Step S13: The first rising edge of the excitation signal output by the microprocessor's built-in timer synchronously triggers the internal timer to start counting, establishing the correlation between the emission time and the timing reference, and providing a time zero point for ultrasonic round-trip time measurement.
[0069] This embodiment generates a stable excitation source using a pulse sequence with a fixed duty cycle. The voltage is boosted by a transformer to ensure the transducer's emission sensitivity. At the same time, it achieves synchronous triggering of the emission action and the timing reference, reducing random deviations in the starting point of time measurement and providing reliable time reference support for liquid level height estimation.
[0070] In one embodiment, step S2: The echo signal reflected from the liquid surface is received by the transducer, processed by the peak sampling circuit to output a millivolt-level voltage signal, and then the echo signal is subjected to peak sampling processing, and then amplified and filtered in sequence to obtain a shaped echo signal. Specifically, the steps are as follows:
[0071] Step S21: The ultrasonic transducer receives the acoustic vibration reflected from the liquid surface and converts it into the original echo voltage, completing the initial conversion of the acoustic signal into an electrical signal, and outputting it to the signal conditioning front end.
[0072] Based on the liquid level value estimated in the previous cycle, the theoretical arrival time of the echo is calculated. Avoiding the continuous period of inherent ringing of the transducer after transmission and the invalid period of over-range, a dynamic sampling window centered on the theoretical arrival time is set. The microprocessor controls the enable state of the peak sampling circuit through an internal timer, and only performs peak sampling of the echo signal within this window, filtering out environmental noise and ringing interference outside the window, and outputting a millivolt-level effective voltage signal with good linearity.
[0073] like Figure 4 As shown, the receiving circuit is a low-noise analog conditioning front-end. The original echo signal output by the transducer is first filtered by the current-limiting resistor R2 and the DC blocking capacitor C1 to remove the DC bias before being sent to the subsequent stage. The bidirectional diode clamping network composed of D1 and D2 in the figure limits the amplitude of the input signal to a safe range of ±0.7V. This not only absorbs the strong ringing noise from the transmitter crosstalk and the spike interference caused by the oil tank bubbles, preventing the subsequent precision operational amplifier and peak sampling circuit from entering the saturation region, but also provides a stable input signal for subsequent filtering and adaptive threshold comparison, adapting to the high reliability detection requirements of weak echoes under narrow pulse excitation.
[0074] Step S22: The original echo voltage is sent to the peak sampling circuit to extract the peak echo voltage and output a millivolt-level effective voltage signal.
[0075] Specifically, the peak sampling circuit samples the peak value of the echo signal, retains the amplitude characteristics of the effective reflection, and provides a stable input for subsequent amplification and filtering.
[0076] Step S23: The millivolt-level voltage signal obtained by peak sampling enters the amplification stage for amplitude boosting, adjusting the weak voltage to the working range that the subsequent circuit can recognize, and obtaining the echo signal after gain adjustment.
[0077] Step S24: The gain-adjusted echo signal passes through a filtering network to filter out environmental electromagnetic noise and interference components, and outputs a stable shaped echo signal.
[0078] The center frequency of the filter network is set to the transducer resonant frequency. ,satisfy:
[0079] ;
[0080] Preferably, the filter passband is aligned with the transducer's rated resonant point to improve the signal-to-noise ratio in oil and gas environments.
[0081] The amplification and bandpass filtering processes described in steps S23 and S24 are implemented through the following filter amplification circuit.
[0082] like Figure 5 As shown, the filter amplifier circuit is based on a cascaded architecture using dual operational amplifiers LM358, designed to condition weak echo signals to logic levels suitable for ADC sampling or comparator triggering. The pre-amplifier is configured as a non-inverting amplifier, providing approximately twice the voltage gain through a 30kΩ feedback resistor R2 and a grounding resistor R3. Simultaneously, a low-pass filter is formed using a 10nF capacitor C1 and a 20kΩ resistor R4 to effectively suppress high-frequency noise. The post-amplifier is also configured as a non-inverting amplifier, with its core gain set by a 127kΩ feedback resistor R6 and a 40.2kΩ grounding resistor R9. Furthermore, a 220Ω resistor R10 introduces DC negative feedback to stabilize the quiescent operating point. The two stages of the circuit are AC coupled through a 10nF capacitor C2, successfully blocking the DC bias of the preceding stage and ensuring that the final output signal CSI1 is symmetrical around 0V. This design achieves bandpass filtering and gain amplification that matches the transducer's center frequency, providing a well-shaped echo signal with excellent signal-to-noise ratio for the subsequent adaptive threshold comparison.
[0083] Step S25: The shaped echo signal is input into the adaptive threshold comparison circuit and compared with the dynamically configured reference threshold. If the threshold is exceeded, an interrupt signal is output to the microprocessor to stop the timing.
[0084] This embodiment uses a cascaded process of peak hold and frequency matched filtering to suppress background interference while preserving the effective shape of the echo, making the weak echo stable and detectable, and providing a reliable signal basis for subsequent trigger timing determination.
[0085] In one embodiment, step S3: Based on the transducer installation height and the estimated liquid level of the previous cycle, a reference threshold for the voltage comparison circuit is dynamically configured. The shaped echo signal is compared with the reference threshold. When the signal amplitude exceeds the threshold, an interrupt signal is output to stop the timing, thus obtaining the ultrasonic round-trip propagation time. This specifically includes the following steps:
[0086] Step S31: Using the transducer installation height parameter and the round-trip propagation time measured in the previous cycle, calculate the approximate depth range of the current liquid surface and output the estimated distance value.
[0087] The estimated distance is calculated using the following formula:
[0088] ;
[0089] In the formula, The vertical distance from the transducer to the bottom of the container. is the round-trip propagation time recorded in the previous cycle, and c is the temperature-corrected ultrasonic propagation speed.
[0090] Step S32: Based on the theoretical amplitude trend of the echo signal obtained by the estimated distance mapping, adjust the reference level of the voltage comparison circuit and output a reference threshold adapted to the current operating condition.
[0091] Specifically, the reference level decreases as the estimated distance increases, matching the natural attenuation characteristics of sound wave propagation in an oil and gas environment.
[0092] The reference threshold is a preset ratio of the estimated echo peak value, which is pre-calibrated based on the attenuation characteristics of the echo amplitude under the oil-gas mixture medium in the water-electricity-oil tank.
[0093] Step S33: The shaped echo signal output from the previous step is sent to the comparison unit for level comparison with the reference threshold. When the instantaneous amplitude of the signal is higher than the set threshold, a trigger pulse is generated and fed back to the microprocessor to stop the internal timing, so as to obtain the ultrasonic round-trip propagation time of the current cycle.
[0094] Preferably, the trigger pulse is directly connected to the microprocessor's external interrupt channel to reduce timing deviations caused by program polling.
[0095] This embodiment uses a preset dynamic threshold based on historical measurement trends to make the level discrimination point conform to the actual change pattern of the echo amplitude, thereby reducing false triggering caused by ringing tail and missed detection of weak echoes in the far field, and improving the stability of the start and end points of time measurement.
[0096] In one embodiment, step S4: Calculating the liquid level height based on the round-trip propagation time and the ultrasonic propagation speed corrected for ambient temperature, and finally estimating the ultrasonic propagation distance and the actual oil level height, specifically includes the following steps:
[0097] Step S41: Continuing from the previous step, the round-trip propagation time of the ultrasonic wave is recorded. The sound velocity parameter, corrected for ambient temperature, is then introduced to calculate the one-way propagation distance of the ultrasonic wave.
[0098] Since the space at the top of the oil storage container / tank is mainly air, the classical empirical formula for the speed of sound is first introduced to estimate the reference speed of sound. :
[0099] ;
[0100] In the formula, T represents the ambient temperature, measured in degrees Celsius.
[0101] Preferably, the ambient temperature is collected by a temperature sensor located in the non-heating area of the oil tank wall next to the transducer, avoiding measurement deviations between oil temperature and air temperature, and providing accurate temperature input for sound velocity correction.
[0102] The corrected ultrasonic propagation speed was calibrated based on the ambient temperature and the characteristics of the oil-gas mixture.
[0103] Specifically, considering that the actual medium is an oil-gas mixture, a proportional correction factor *m* is introduced to correct the above sound velocity, where *m* is calibrated based on the measured sound velocity values under three typical operating conditions: a full tank, a half tank, and an empty tank. The corrected sound velocity... The calculation is as follows:
[0104] ;
[0105] In the formula, This is a proportional correction factor for the oil-gas mixture above the hydroelectric oil tank, calibrated based on measured sound velocity values under three typical operating conditions: full tank, half tank, and empty tank.
[0106] The distance calculation relationship is as follows:
[0107] ;
[0108] In the formula, L represents the one-way propagation distance. The corrected speed of sound is given by t, which is the round-trip propagation time.
[0109] Step S42: Combine the preset installation height from the transducer to the bottom of the oil storage container, subtract the one-way propagation distance to calculate the relative liquid level value, output the original liquid level height of the current measurement cycle, and finally calculate the actual oil level height.
[0110] Specifically, the preset installation height is written into the equipment configuration table as a fixed geometric parameter, eliminating the need for repeated calibration on site;
[0111] Preferably, to address the slight offset of the transducer installation reference caused by the long-term operation of the hydropower station's turbine generator unit, the installation height is finely adjusted and calibrated quarterly based on the measurement values under empty oil tank conditions to offset the cumulative installation error caused by vibration.
[0112] Step S43: Smooth the raw liquid level height of multiple consecutive measurement cycles to suppress data jumps caused by instantaneous bubble disturbances, and output the final liquid level monitoring value.
[0113] Preferably, the smoothing filter uses a moving average method to maintain the continuity of the data output;
[0114] Preferably, for minor offsets in the transducer installation reference caused by unit vibration, the vibration amplitude threshold is first screened for single-cycle measurements before moving average filtering to remove abnormal measurements that exceed the normal vibration amplitude, thereby further improving data stability.
[0115] This embodiment uses a solution logic that converts time quantities into liquid level quantities based on geometric height differences, avoiding direct reliance on fixed sound path mapping. Combined with a timing smoothing step, it reduces the interference of instantaneous fluctuations in the oil and gas environment on the readings, thereby improving the stability of the liquid level output results and the reliability of long-term monitoring.
[0116] Secondly, this application provides an ultrasonic-based oil level measurement system, including a microprocessor, a power drive module, an ultrasonic transducer, a peak sampling circuit, a signal conditioning module, and an adaptive threshold comparison circuit.
[0117] The microprocessor is configured to generate a narrow pulse train excitation signal and synchronously start timing, and is also configured to dynamically output a threshold configuration signal based on the estimated liquid level.
[0118] The power drive module is connected between the PWM output terminal of the microprocessor and the transducer, and is used to amplify the power of the pulse train and boost the voltage of the transformer.
[0119] The peak sampling circuit is connected to the echo terminal of the transducer and is used to extract the millivolt-level peak voltage of the echo signal.
[0120] The signal conditioning module includes a preamplifier stage and a filter stage in sequence, and its output is connected to the adaptive threshold comparison circuit.
[0121] The adaptive threshold comparison circuit receives the threshold configuration signal to adjust the reference level, compares the shaped echo signal with the reference level, and outputs an interrupt signal to the external interrupt pin of the microprocessor to stop the timing.
[0122] The microprocessor is also configured to calculate the liquid level height based on timing results combined with temperature-compensated sound velocity.
[0123] like Figure 6 The diagram shown is an overall schematic of the ultrasonic oil level measurement system provided in this embodiment. The system uses a microprocessor as its core scheduling hub, and the hardware connections and signal flows of each functional module perfectly match the aforementioned system configuration.
[0124] Figure 6 The control circuit in the text corresponds to the aforementioned microprocessor. Besides handling the overall system operation scheduling, its built-in internal timer and... Figure 6 The standard oscillation circuit and counting circuit shown work together to provide a high-precision time reference for measuring the round-trip time of ultrasonic waves. The pulse transmission circuit, corresponding to the aforementioned power drive module, receives the narrow pulse train excitation signal output by the microprocessor, completes power amplification and voltage boosting, and drives the ultrasonic transmitter (i.e., the aforementioned ultrasonic transducer) to emit detection sound waves towards the surface of the oil storage container. The ultrasonic receiver (also belonging to the aforementioned ultrasonic transducer) receives the echo signal reflected from the liquid surface and sends it to the pulse receiving circuit for processing. This pulse receiving circuit corresponds to the aforementioned peak sampling circuit, signal conditioning module, and adaptive threshold comparison circuit, which sequentially completes peak extraction, amplification filtering, and threshold comparison processing of the echo signal, and finally outputs a stop timing signal to the external interrupt pin of the microprocessor. Based on the timing result and the temperature-compensated sound velocity parameters, the microprocessor can calculate the current oil level.
[0125] This overall architecture achieves seamless coordination of the entire process—from transmission excitation and echo processing to time measurement and liquid level calculation—through modular design. It not only meets the execution requirements of the aforementioned oil level measurement method based on dynamic sampling windows and adaptive thresholds, but also effectively suppresses ringing interference and amplitude attenuation in hydroelectric oil tank scenarios, ensuring measurement accuracy and long-term operational reliability. In one embodiment, the adaptive threshold comparison circuit is an integrated voltage comparator. The DAC output or PWM filter output of the microprocessor is connected to the reference voltage pin of the voltage comparator for issuing the dynamic reference threshold.
[0126] In one embodiment, the microprocessor is further configured to determine a transducer malfunction or oil level over-range when no interrupt signal is detected from the voltage comparison circuit within a preset number of consecutive cycles, and to output an alarm signal.
[0127] Thirdly, embodiments of this application provide an ultrasonic-based oil level measuring device, which can be a personal computer (PC), laptop computer, server, or other device with data processing capabilities.
[0128] The communication bus can be of any type and is used to interconnect the processor, memory, and communication interface.
[0129] The communication interface includes input / output (I / O) interfaces, physical interfaces, and logical interfaces for interconnecting internal components of the ultrasonic-based oil level measurement equipment, as well as interfaces for interconnecting the ultrasonic-based oil level measurement equipment with other devices (such as other computing devices or user equipment). Physical interfaces can be Ethernet interfaces, fiber optic interfaces, ATM interfaces, etc.; user equipment can be displays, keyboards, etc.
[0130] Memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.
[0131] The processor can be a general-purpose processor, which can call the ultrasonic-based oil level measurement program stored in the memory and execute the ultrasonic-based oil level measurement method provided in the embodiments of this application. For example, the general-purpose processor can be a central processing unit (CPU). The method executed when the ultrasonic-based oil level measurement program is called can be referred to in the various embodiments of the ultrasonic-based oil level measurement method of this application, and will not be repeated here.
[0132] Fourthly, embodiments of this application also provide a readable storage medium.
[0133] This application has a readable storage medium storing an ultrasonic-based oil level measurement program, wherein when the ultrasonic-based oil level measurement program is executed by a processor, it implements the steps of the ultrasonic-based oil level measurement method described above.
[0134] The method implemented when the ultrasonic-based oil level measurement program is executed can be referred to in the various embodiments of the ultrasonic-based oil level measurement method of this application, and will not be repeated here.
[0135] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0136] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. An ultrasonic-based oil level measurement method, characterized in that, Includes the following steps: A narrow pulse train excitation signal with a preset frequency is generated, which is then amplified and boosted to drive the ultrasonic transducer to emit ultrasonic waves toward the surface of the oil storage container, and a timing is started simultaneously. The echo signal reflected from the liquid surface is received by the transducer. After the peak sampling circuit processes the signal and outputs a millivolt-level voltage signal, the echo signal is subjected to peak sampling processing, and then amplified and filtered in sequence to obtain the shaped echo signal. Based on the transducer installation height and the estimated liquid level of the previous cycle, the reference threshold of the voltage comparison circuit is dynamically configured, and the shaped echo signal is compared with the reference threshold. When the signal amplitude exceeds the threshold, an interrupt signal is output to stop the timing, and the ultrasonic round-trip propagation time is obtained. Based on the round-trip propagation time and the ultrasonic propagation speed corrected for ambient temperature, the liquid level height is calculated, and the ultrasonic propagation distance and the actual oil level height are finally derived.
2. The ultrasonic-based oil level measurement method according to claim 1, characterized in that, The signal, after power amplification and boosting, is matched to the resonant drive voltage of the ultrasonic transducer via an impedance matching network and then output to the transducer's transmitting electrode.
3. The ultrasonic-based oil level measurement method according to claim 1, characterized in that, The dynamic configuration reference threshold specifically includes: The current estimated liquid level depth is estimated based on the vertical distance from the transducer mounting reference surface to the bottom of the container and historical liquid level data. The expected echo amplitude is calculated based on the attenuation model of ultrasound in the gaseous medium. The reference voltage of the voltage comparison circuit is adjusted to a preset ratio of the estimated echo peak value.
4. The ultrasonic-based oil level measurement method according to claim 1, characterized in that, The amplification and filtering process is an analog link process. The shaped echo signal is directly input to the voltage comparison circuit without analog-to-digital conversion, and the echo arrival time is directly captured by the external interrupt pin of the microprocessor.
5. The ultrasonic-based oil level measurement method according to claim 1, characterized in that, Also includes: The round-trip propagation time of multiple measurement cycles is continuously acquired. The liquid level height is then calculated after applying a moving average filter to the propagation time. The calculation formula is as follows: ; Where H is the liquid level height. The vertical distance from the transducer mounting reference surface to the bottom of the container is given by t, the round-trip propagation time is given by c, and the corrected ultrasonic propagation speed is given by c.
6. The ultrasonic-based oil level measurement method according to claim 5, characterized in that, The corrected ultrasonic propagation speed The following formula is used to calculate: ; Where T is the ambient temperature and m is the proportional correction coefficient for the oil-gas mixture above the water-electricity-oil tank.
7. The ultrasonic-based oil level measurement method according to claim 1, characterized in that, It also includes an oil level anomaly diagnosis step: if the interruption signal is not detected within a preset number of consecutive times, it is determined that the transducer is faulty or the oil level is over-range and an alarm signal is output. The preset number of times is configured according to the oil tank operating noise level.
8. An ultrasonic-based oil level measurement system, characterized in that, It includes a microprocessor, a power drive module, an ultrasonic transducer, a peak sampling circuit, a signal conditioning module, and an adaptive threshold comparison circuit; The microprocessor is configured to generate a narrow pulse train excitation signal and synchronously start timing, and is also configured to dynamically output a threshold configuration signal based on the estimated liquid level. The power drive module is connected between the PWM output terminal of the microprocessor and the transducer, and is used to amplify the power of the pulse train and boost the voltage of the transformer. The peak sampling circuit is connected to the echo terminal of the transducer and is used to extract the millivolt-level peak voltage of the echo signal. The signal conditioning module includes a preamplifier stage and a filter stage in sequence, and its output is connected to the adaptive threshold comparison circuit. The adaptive threshold comparison circuit receives the threshold configuration signal to adjust the reference level, compares the shaped echo signal with the reference level, and outputs an interrupt signal to the external interrupt pin of the microprocessor to stop the timing. The microprocessor is also configured to calculate the liquid level height based on timing results combined with temperature-compensated sound velocity.
9. The ultrasonic-based oil level measurement system according to claim 8, characterized in that, The adaptive threshold comparison circuit is an integrated voltage comparator. The DAC output or PWM filter output of the microprocessor is connected to the reference voltage pin of the voltage comparator to issue the dynamic reference threshold.
10. The ultrasonic-based oil level measurement system according to claim 8, characterized in that, The microprocessor is also configured to determine that the transducer is faulty or the oil level is over-range when no interrupt signal is detected from the voltage comparison circuit within a preset number of consecutive cycles, and to output an alarm signal.
