Liquid level measurement method, device, electronic device and storage medium
By combining multiple filtering models with a weighted fusion method, the problem of signal deviation in mobile water tank level measurement was solved, achieving high-precision level measurement under non-stationary conditions and ensuring the safety and stability of coal transportation in ports.
Patent Information
- Application Number
- CN202511803008.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-04-07
- Estimated Expiration
- 2045-12-03
AI Technical Summary
In port coal transportation, the liquid level measurement of mobile water tanks is affected by external vibrations and bumps, causing the sensor output signal to deviate from the actual liquid level, which affects transportation safety.
A weighted fusion method combining multiple filtering models is adopted. By acquiring liquid level signals and acceleration, a preset sliding window filtering model is used, the window size is dynamically adjusted, and a filtering model adapted to the liquid level state is selected. After multiple filtering processes, the results are weighted and fused to obtain the final liquid level measurement result.
It improves the accuracy and reliability of liquid level measurement under non-stationary conditions, reduces noise interference, ensures the precision and stability of liquid level measurement, supports timely detection of water tank leaks, and ensures transportation safety.
Smart Images

Figure CN121230842B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the field of liquid level measurement, and in particular to a liquid level measurement method and device, electronic equipment and storage medium. BACKGROUND
[0002] In the port coal transportation industry, a large amount of dust is generated during the stacking and unstacking of the transit coal, so it is urgent to regularly water the coal pile to reduce dust generation. The mobile water tank is the best choice to meet the water replenishment of the stockyard and single machine operation, but due to the mobile state of the water tank, external vibration, jolt, acceleration of the water tank and other conditions, the liquid level is not in a stable state, and the traditional monitoring means such as strain sensor and pressure sensor have weak anti-external interference ability, thus causing the deviation between the signal output by the sensor and the real liquid level, thereby affecting the safety guarantee of transportation. SUMMARY
[0003] The purpose of the present application is to at least provide a liquid level measurement method, device, electronic equipment and storage medium, which can at least solve the technical problem that the deviation between the signal output by the sensor and the real liquid level occurs when the liquid level is in a non-stationary state, and can at least achieve the reliability of liquid level measurement when the liquid level is in a non-stationary state.
[0004] To solve the above technical problems, at least one embodiment of the present application provides a liquid level measurement method, comprising:
[0005] obtaining a liquid level signal obtained by monitoring a to-be-measured liquid surface and / or an acceleration during liquid movement;
[0006] performing at least two filtering processes based on the liquid level signal and / or the acceleration:
[0007] processing the liquid level signal by using a preset first filtering model to obtain a first measurement result of the liquid level, wherein the first filtering model is used to process the liquid level signal by using historical liquid level signals in a preset sliding window;
[0008] adjusting the size of the sliding window according to the acceleration to obtain a second filtering model, processing the liquid level signal by using the second filtering model to obtain a second measurement result of the liquid level;
[0009] determining a current liquid level state according to the fluctuation of the liquid level signal, determining a third filtering model corresponding to the current liquid level state based on a preset corresponding relationship between liquid level states and third filtering models, and processing the liquid level signal by using the third filtering model to obtain a third measurement result of the liquid level;
[0010] The liquid level is obtained by weighted fusion of at least two of the first measurement result, the second measurement result, and the third measurement result.
[0011] At least one embodiment of this application also provides a liquid level measuring device, comprising:
[0012] The acquisition module is used to acquire the liquid level signal obtained from the current liquid level monitoring and / or the acceleration of the liquid movement;
[0013] The filtering module is used to perform at least two of the following filtering processes based on the liquid level signal and / or the acceleration:
[0014] The liquid level signal is processed using a preset first filtering model to obtain a first measurement result of the liquid level. The first filtering model is used to process the liquid level signal using historical liquid level signals within a preset sliding window.
[0015] The size of the sliding window is adjusted according to the acceleration to obtain a second filtering model. The liquid level signal is then processed using the second filtering model to obtain a second measurement result of the liquid level.
[0016] The current liquid level state is determined based on the fluctuation of the liquid level signal. Based on the preset correspondence between the liquid level state and the third filtering model, the third filtering model corresponding to the current liquid level state is determined. The liquid level signal is then processed using the third filtering model to obtain the third measurement result of the liquid level.
[0017] The weighted fusion module is used to weight and fuse at least two of the first measurement result, the second measurement result, and the third measurement result to obtain the final measurement result of the liquid level.
[0018] At least one embodiment of this application also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the liquid level measurement method described above.
[0019] At least one embodiment of this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the liquid level measurement method described above.
[0020] The liquid level measurement method, apparatus, electronic device, and storage medium provided in the embodiments of this application utilize a first filtering model to process the current liquid level signal using historical liquid level signals within a preset sliding window. This sliding window-based filtering method has a relatively simple algorithm, low computational load, and can run quickly in liquid level measurement systems with high real-time requirements, providing timely measurement results. Adjusting the size of the sliding window according to acceleration allows the filtering model to better adapt to the dynamic changes in liquid movement. By dynamically adjusting the sliding window, the second filtering model can more accurately measure the liquid level under liquid movement conditions, avoiding measurement errors caused by a fixed window size and improving the accuracy of dynamic liquid level measurement. Through a preset correspondence between liquid level state and the third filtering model, the most suitable filtering model can be selected for different liquid level states. For example, in a stable liquid level state, a filtering model that performs well in processing stable signals can be selected; in a fluctuating liquid level state, a filtering model that effectively suppresses fluctuation interference can be selected. This targeted filtering processing can further improve the accuracy of liquid level measurement. Weighted fusion of measurement results obtained from different filtering processes can combine the advantages of various filtering methods. Each filtering method has its limitations. By using weighted fusion, we can give full play to their advantages in different aspects and make up for their shortcomings, thereby obtaining more accurate and reliable liquid level measurement results.
[0021] In some alternative embodiments, the magnitude of the acceleration is inversely proportional to the window size.
[0022] In this embodiment, the greater the acceleration, the smaller the sliding window; the smaller the acceleration, the larger the sliding window. When the liquid is moving violently and the acceleration is large, a smaller sliding window allows the filtering model to respond more quickly to changes in the liquid level signal, promptly capturing new changes in the liquid level and making the measurement results closer to reality. When the liquid is stationary or moving slowly with low acceleration, a larger sliding window can make full use of more historical data to obtain more reliable liquid level values.
[0023] In some optional embodiments, adjusting the size of the sliding window according to the acceleration includes:
[0024] Within a preset damping time constant range, the target damping time constant corresponding to the acceleration is determined based on the ratio of the acceleration to a preset acceleration threshold.
[0025] The target damping time constant is rounded to obtain the adjusted window size.
[0026] In this embodiment, a suitable damping time constant and window size help suppress noise interference during the measurement process. Adjusting the damping time constant within a preset range prevents extreme situations caused by excessively large or small sliding window settings. Ensuring the window size is within a relatively stable and appropriate range enhances the system's stability under various operating conditions.
[0027] In some optional embodiments, in the correspondence between the liquid level state and the third filtering model, the more severe the fluctuation of the liquid level state, the greater the filtering strength of the corresponding third filtering model.
[0028] In this embodiment, the filtering strength is matched to the degree of liquid level fluctuation, which avoids errors caused by insufficient or excessive filtering. If a model with low filtering strength is used when the liquid level fluctuates drastically, it cannot effectively eliminate noise, leading to large deviations in the measurement results; while if a model with high filtering strength is used when the liquid level is stable, it may over-smooth the real signal and lose information about liquid level changes. This correspondence ensures that relatively accurate measurement results can be obtained under different liquid level conditions, improving the overall measurement accuracy.
[0029] In some optional embodiments, the correspondence between the liquid level state and the third filtering model includes the following:
[0030] When the liquid level is in the first state, the third filtering model is an exponential smoothing filtering model;
[0031] When the liquid level is in the second state, the third filtering model is a weighted moving average filtering model, with more recent liquid level signals having a greater weight.
[0032] When the liquid level is in the third state, the third filtering model is the median filtering model;
[0033] The intensity of fluctuations in the first state, the second state, and the third state increases sequentially.
[0034] In this embodiment, when the liquid level is in the first state, i.e., the fluctuation is relatively stable, the exponential smoothing filter model provides a more accurate liquid level measurement. In the second state, when the liquid level fluctuation is more aggravated, the weighted moving average filter model is more suitable and can better highlight the importance of recent data. When the liquid level fluctuates to a certain extent, it can more accurately reflect the real-time situation of the liquid level and reduce the measurement deviation caused by the averaging effect. When the liquid level is in the third state, when the fluctuation is most severe, the median filter model can eliminate the interference of outliers and obtain a measurement result that is closer to the true liquid level.
[0035] In some optional embodiments, when performing weighted fusion of at least two results, weights are set for the corresponding filtering models based on the accuracy of each of the at least two filtering models corresponding to the at least two results within a preset error observation window. The higher the accuracy, the greater the corresponding weight.
[0036] In this embodiment, different filtering models have their own characteristics and may perform well in different aspects when processing liquid level signals. By weighting and fusing based on accuracy, the advantages of each filtering model can be combined to obtain measurement results that are closer to the actual liquid level.
[0037] In some optional embodiments, the step of setting weights for the corresponding filtering models based on the accuracy of each of the at least two filtering models corresponding to at least two results within a preset error observation window includes:
[0038] Within the error observation window, the average absolute error of the corresponding filter model is calculated based on the liquid level results corresponding to at least two filter models and the reference liquid level result. The reference liquid level result is predicted by a preset reference liquid level prediction model. The reference liquid level prediction model is obtained by simulating the liquid level test data obtained by selecting different working conditions on site in advance.
[0039] The reciprocal of the mean absolute error is used as the weight of the corresponding filtering model.
[0040] In this embodiment, the mean absolute error (MAE) directly reflects the degree of deviation between the predicted result of the filtering model and the reference liquid level result. By calculating the MAE of each filtering model within the error observation window, the actual performance of each model can be precisely quantified. If the MAE of a filtering model is small, it indicates that its predicted result is close to the reference liquid level, and the prediction accuracy is high; conversely, a large MAE indicates that the model has a large error. Using the reciprocal of the MAE as a weight, models with high accuracy occupy a larger proportion in the weighted fusion, thereby effectively improving the overall measurement accuracy. Attached Figure Description
[0041] One or more embodiments are illustrated by way of example with reference to the accompanying drawings, and these illustrative descriptions do not constitute a limitation on the embodiments.
[0042] Figure 1 This is a flowchart of a liquid level measurement method provided in one embodiment of this application;
[0043] Figure 2 This is a schematic diagram of the data acquisition and processing process of a liquid level measurement system according to an embodiment of this application;
[0044] Figure 3Figure (a) in this application is a comparative schematic diagram of liquid level measurement results before and after using a waveguide, provided in another embodiment of this application;
[0045] Figure 3 Figure (b) is a schematic diagram comparing measurement errors before and after using a waveguide, provided in another embodiment of this application;
[0046] Figure 4 This is an error comparison chart of different filtering models provided in another embodiment of this application;
[0047] Figure 5 This is a performance comparison diagram of different filtering models provided in another embodiment of this application;
[0048] Figure 6 This is a schematic diagram of a liquid level measuring device provided in another embodiment of this application. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been provided in the various embodiments of this application to help readers better understand this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various changes and modifications based on the following embodiments. The division of the various embodiments below is for the convenience of description and should not constitute any limitation on the specific implementation of this application. The various embodiments can be combined with and referenced by each other without contradiction.
[0050] To facilitate understanding of the embodiments of this application, relevant content regarding port coal transportation will be introduced first.
[0051] In the port coal transportation industry, a large amount of dust is generated during the stacking and reclaiming of transshipment coal. Therefore, it is urgent to replenish the coal pile with water regularly to reduce dust generation. Mobile water tanks are the optimal choice to meet the needs of water replenishment in the stockpile and single-machine operation.
[0052] However, since the water tank is in a moving state, external vibrations, bumps, and accelerated movement of the water tank can cause it to crack and leak, affecting normal operations. Traditional monitoring methods such as strain gauge sensors and pressure sensors have weak resistance to external interference and have local defects. Accurately measuring the liquid level changes of the moving water tank is crucial for timely detection of leaks, ensuring transportation safety, optimizing work processes, and rationally allocating resources.
[0053] External vibrations and other factors can cause water sloshing and wave formation, resulting in a non-stable liquid level. The liquid level sensor signal is then affected by the random and complex wave noise. Irregular reflections from the wave surface generate multiple echoes, increasing the number of echoes received by the sensor per unit time. This leads to a significantly higher output signal frequency, interfering with accurate liquid level measurement and causing a deviation between the sensor's output signal and the actual liquid level. The complex and variable high-frequency signal increases the difficulty of signal processing, necessitating the development of a novel filtering method to improve the accuracy and stability of the output signal and accurately monitor changes in the water tank level.
[0054] To address the technical problem of discrepancies between the sensor output signal and the actual liquid level when the liquid level is in a non-steady state, this invention proposes a liquid level measurement method. The implementation details of the liquid level measurement method in this embodiment are described below. The following content is only for ease of understanding and is not necessary for implementing this solution.
[0055] Example 1:
[0056] The liquid level measurement method of this embodiment can be applied to electronic devices with communication, computing, and data storage capabilities. Its specific process can be as follows: Figure 1 As shown, it includes:
[0057] Step 110: Obtain the liquid level signal obtained from the current liquid level monitoring and / or the acceleration of the liquid during movement;
[0058] Specifically, an ultrasonic level gauge can be installed on top of the mobile water tank, perpendicular to the liquid surface, ensuring that the ultrasonic waves can propagate smoothly to the liquid surface and receive the reflected echoes, thereby obtaining the liquid level signal. A triaxial accelerometer is installed on the mobile water tank to collect the tank's acceleration data along three axes in real time. In this embodiment, the acceleration is the acceleration of the axis containing the direction of the water tank's movement. The ultrasonic level gauge and the triaxial accelerometer are connected to the control system, which uses a PLC as an example. The sensors are connected to the PLC's analog input module via shielded cables, stably transmitting the monitoring data to the control system for subsequent data processing.
[0059] Step 120: Perform at least two of the following filtering processes based on the liquid level signal and / or the acceleration:
[0060] The liquid level signal is processed using a preset first filtering model to obtain a first measurement result of the liquid level. The first filtering model is used to process the liquid level signal using historical liquid level signals within a preset sliding window.
[0061] The size of the sliding window is adjusted according to the acceleration to obtain a second filtering model. The liquid level signal is then processed using the second filtering model to obtain a second measurement result of the liquid level.
[0062] The current liquid level state is determined based on the fluctuation of the liquid level signal. Based on the preset correspondence between the liquid level state and the third filtering model, the third filtering model corresponding to the current liquid level state is determined. The liquid level signal is then processed using the third filtering model to obtain the third measurement result of the liquid level.
[0063] Specifically, in practical liquid level measurement scenarios, due to various interference factors such as sensor noise and environmental changes, the directly acquired liquid level signal is often inaccurate and unstable. To obtain more reliable and accurate liquid level measurement results, filtering techniques are required. Acceleration information can reflect the dynamic changes of the system; combining it with the liquid level signal can further improve the filtering effect. This paper proposes at least two filtering methods to optimize the liquid level signal from different perspectives, adapting to different measurement needs and environmental conditions.
[0064] The first filtering model employs a filtering method based on a preset sliding window. The sliding window is a data interval of fixed size that slides across the time series at certain step sizes. This window contains historical liquid level signal data. The model uses this historical data to process the current liquid level signal, smoothing it through some statistical or computational method (such as average, median, etc.) to reduce the impact of random noise.
[0065] For example, assuming the sliding window size is N and the current time is t, the historical liquid level signal within the window is: , ,……, By averaging these data, a smoothed value of the current liquid level signal is obtained as the first measurement result. This method is simple to implement, has a relatively small computational load, and can effectively remove some high-frequency random noise, making the liquid level signal smoother. It is suitable for scenarios with high real-time requirements and relatively stable liquid level changes.
[0066] Acceleration reflects the intensity of system motion. Large acceleration indicates a rapidly changing system, potentially causing significant fluctuations in the liquid level signal. In such cases, using a fixed-size sliding window may fail to capture level changes promptly, leading to delayed or inaccurate filtering results. Therefore, the sliding window size should be dynamically adjusted based on the magnitude of the acceleration.
[0067] In practical implementation, a mapping relationship between acceleration and the size of the sliding window can be established. A second filtering model is constructed using the adjusted sliding window, and the liquid level signal is processed using similar statistical or computational methods as the first filtering model to obtain a second measurement result of the liquid level. This method can adaptively adjust the filtering parameters according to the dynamic changes of the system, improving the accuracy and adaptability of the filtering.
[0068] The fluctuation of liquid level signals can be determined by analyzing historical data and calculating fluctuation indices such as variance and standard deviation. Based on the magnitude of these indices, the liquid level state can be categorized into different types, such as stable, low-fluctuation, and high-fluctuation states. For different liquid level states, a corresponding third-level filtering model is preset. For stable states, simpler filtering methods, such as low-pass filtering, can be used to further remove minor noise. For low-fluctuation states, adaptive filtering algorithms can be used to automatically adjust filtering parameters according to signal changes. For high-fluctuation states, more complex filtering techniques, such as Kalman filtering, may be required, combining the system's dynamic model and observational data to more accurately estimate the liquid level value.
[0069] Based on the determined current liquid level state, a corresponding third filtering model is selected from a preset correspondence to process the liquid level signal. For example, if the current liquid level state is in a state of small fluctuation, an adaptive filtering algorithm is selected. This algorithm adjusts the filtering coefficients according to the real-time changes in the liquid level signal, so that the filtering result can better track the actual changes in the liquid level, thereby obtaining a more accurate third measurement result.
[0070] Step 130: Weighted fusion of at least two of the first measurement result, the second measurement result, and the third measurement result to obtain the final measurement result of the liquid level.
[0071] Specifically, any two measurement results can be combined, or a weighted fusion of three total measurement results can be performed. In practical applications, only the liquid level signal can be acquired, and the first and third measurement results can be calculated using the first and third filtering models, respectively. In some optional embodiments, the liquid level signal and acceleration information can be acquired simultaneously, the second filtering result can be calculated using the second filtering model, and then the corresponding filtering result can be calculated using at least one of the first and third filtering models.
[0072] In summary, the first filtering model processes the current liquid level signal using historical liquid level signals within a preset sliding window. This sliding window-based filtering method has a relatively simple algorithm, low computational load, and can run quickly in liquid level measurement systems with high real-time requirements, providing timely measurement results. Adjusting the size of the sliding window based on acceleration allows the filtering model to better adapt to dynamic changes in liquid movement. By dynamically adjusting the sliding window, the second filtering model can more accurately measure the liquid level under liquid movement conditions, avoiding measurement errors caused by a fixed window size and improving the accuracy of dynamic liquid level measurement. Through the preset correspondence between liquid level state and the third filtering model, the most suitable filtering model can be selected for different liquid level states. For example, in a stable liquid level state, a filtering model that performs well in processing stable signals can be selected; in a fluctuating liquid level state, a filtering model that effectively suppresses fluctuation interference can be selected. This targeted filtering process can further improve the accuracy of liquid level measurement. Weighted fusion of the measurement results obtained from different filtering processes can combine the advantages of various filtering methods. Each filtering method has its limitations. By using weighted fusion, we can give full play to their advantages in different aspects and make up for their shortcomings, thereby obtaining more accurate and reliable liquid level measurement results.
[0073] In some alternative embodiments, the magnitude of the acceleration is inversely proportional to the window size.
[0074] Specifically, an inverse proportional function between acceleration and window size can be constructed, or acceleration can be divided into different levels according to its magnitude, with each level corresponding to a window size.
[0075] In this embodiment, the greater the acceleration, the smaller the sliding window; the smaller the acceleration, the larger the sliding window. When the liquid is moving violently and the acceleration is large, a smaller sliding window allows the filtering model to respond more quickly to changes in the liquid level signal, promptly capturing new changes in the liquid level and making the measurement results closer to reality. When the liquid is stationary or moving slowly with low acceleration, a larger sliding window can make full use of more historical data to obtain more reliable liquid level values.
[0076] In some optional embodiments, adjusting the size of the sliding window according to the acceleration includes: within a preset damping time constant range, determining a target damping time constant corresponding to the acceleration based on the ratio of the acceleration to a preset acceleration threshold; and rounding the target damping time constant to obtain the adjusted window size.
[0077] Specifically, dynamic damping adjustment can dynamically adjust the damping according to the movement of the water tank. When the signal changes rapidly, a smaller window is used to improve the response speed, and when the signal changes slowly, a larger window is used to enhance the smoothing effect.
[0078] The principle of dynamic damping adjustment is as follows:
[0079]
[0080] in, Represents the dynamic damping time constant at the current moment. Minimum damping time constant Maximum damping time constant acceleration acceleration threshold Moving average window according to Rounded to the nearest whole number It is the output signal after dynamic damping adjustment processing. It is a liquid level signal.
[0081] In this embodiment, a suitable damping time constant and window size help suppress noise interference during the measurement process. Adjusting the damping time constant within a preset range prevents extreme situations caused by excessively large or small sliding window settings. Ensuring the window size is within a relatively stable and appropriate range enhances the system's stability under various operating conditions.
[0082] In some optional embodiments, in the correspondence between the liquid level state and the third filtering model, the more severe the fluctuation of the liquid level state, the greater the filtering strength of the corresponding third filtering model.
[0083] In this embodiment, the filtering strength is matched to the degree of liquid level fluctuation, which avoids errors caused by insufficient or excessive filtering. If a model with low filtering strength is used when the liquid level fluctuates drastically, it cannot effectively eliminate noise, leading to large deviations in the measurement results; while if a model with high filtering strength is used when the liquid level is stable, it may over-smooth the real signal and lose information about liquid level changes. This correspondence ensures that relatively accurate measurement results can be obtained under different liquid level conditions, improving the overall measurement accuracy.
[0084] In some optional embodiments, the correspondence between the liquid level state and the third filtering model includes the following:
[0085] When the liquid level is in the first state, the third filtering model is an exponential smoothing filtering model;
[0086] When the liquid level is in the second state, the third filtering model is a weighted moving average filtering model, with more recent liquid level signals having a greater weight.
[0087] When the liquid level is in the third state, the third filtering model is the median filtering model.
[0088] The intensity of fluctuations in the first state, the second state, and the third state increases sequentially.
[0089] Specifically, the process of the third filtering model adaptively adjusting according to the liquid level status includes the following:
[0090] ,
[0091] in, It is the liquid level difference. It is the sampling frequency.
[0092] ,
[0093] in, This is the second filtering model. For the first filtering model after adjusting the window, This is a liquid level signal. For smoothing coefficients, The size of the sliding window. It is the liquid level difference between time i and time i-1. The first threshold, The second threshold, The standardized weights are calculated using the following formula:
[0094] ;
[0095] .
[0096] when Less than When the liquid level is in the first state (e.g., stable state), when lie in and In between, when the liquid level is in the second state (e.g., transition state), when ≥ When the liquid level is in the third state (e.g., the intense state).
[0097] In this embodiment, when the liquid level is in the first state, i.e., the fluctuation is relatively stable, the exponential smoothing filter model provides a more accurate liquid level measurement. In the second state, when the liquid level fluctuation is more aggravated, the weighted moving average filter model is more suitable and can better highlight the importance of recent data. When the liquid level fluctuates to a certain extent, it can more accurately reflect the real-time situation of the liquid level and reduce the measurement deviation caused by the averaging effect. When the liquid level is in the third state, when the fluctuation is most severe, the median filter model can eliminate the interference of outliers and obtain a measurement result that is closer to the true liquid level.
[0098] In some alternative embodiments, in addition to the exponential smoothing filter model, weighted moving average filter model, and median filter model exemplified above, other filter models may also be used. No specific limitations are imposed here.
[0099] In some optional embodiments, when performing weighted fusion of at least two results, weights are set for the corresponding filtering models based on the accuracy of each of the at least two filtering models corresponding to the at least two results within a preset error observation window. The higher the accuracy, the greater the corresponding weight.
[0100] Specifically, by quantifying the error performance of each filtering model over historical observation periods, such as root mean square error (RMSE) and mean absolute error (MAE), accuracy is mapped to weighting coefficients. Models with higher accuracy occupy a larger proportion in the fusion, thereby improving the overall accuracy of the measurement results.
[0101] In this embodiment, different filtering models have their own characteristics and may perform well in different aspects when processing liquid level signals. By weighting and fusing based on accuracy, the advantages of each filtering model can be combined to obtain measurement results that are closer to the actual liquid level.
[0102] In some optional embodiments, the step of setting weights for the corresponding filter models based on the accuracy of each of the at least two filter models corresponding to the at least two results within a preset error observation window includes: within the error observation window, calculating the mean absolute error of the corresponding filter model based on the liquid level results corresponding to the at least two filter models and the reference liquid level result, wherein the reference liquid level result is predicted by a preset reference liquid level prediction model, and the reference liquid level prediction model is obtained by simulating the liquid level test data obtained under different working conditions selected on site in advance; and using the reciprocal of the mean absolute error as the weight of the corresponding filter model.
[0103] Specifically, test data is first obtained under different operating conditions on-site. Then, using the test data as accurate values, simulations are performed on a computer. By adjusting different methods and parameters, the simulation results are considered to be basically consistent with the test results. If so, the method and parameters are deemed appropriate, and a reference liquid level prediction model is obtained. The reference liquid level prediction model can predict the liquid level height at any given time. This model is then applied on-site to evaluate the accuracy of different filtering models at the current moment.
[0104] In this embodiment, the first measurement result, the second measurement result, and the third measurement result are weighted and fused as follows:
[0105] ,
[0106] in, These are the first measurement result, the second measurement result, and the third measurement result, respectively. These represent the mean absolute errors of the three filtering models. For the final measurement result,
[0107] ,
[0108] The size of the error observation window, This represents the reference liquid level at time j within the error observation window. This represents the liquid level measurement result of the i-th filter model at time j. Let it be a very small positive number, and the denominator is guaranteed to be non-zero.
[0109] In this embodiment, the mean absolute error (MAE) directly reflects the degree of deviation between the predicted result of the filtering model and the reference liquid level result. By calculating the MAE of each filtering model within the error observation window, the actual performance of each model can be precisely quantified. If the MAE of a filtering model is small, it indicates that its predicted result is close to the reference liquid level, and the prediction accuracy is high; conversely, a large MAE indicates that the model has a large error. Using the reciprocal of the MAE as a weight, models with high accuracy occupy a larger proportion in the weighted fusion, thereby effectively improving the overall measurement accuracy.
[0110] Example 2:
[0111] Based on the above embodiments, this embodiment provides an application example, namely a liquid level measurement system. The specific data acquisition and processing flow of the liquid level measurement system is as follows: Figure 2 As shown, the liquid level measurement system installs an ultrasonic level gauge on the top of the movable water tank, perpendicular to the liquid surface, to ensure that the ultrasonic waves can propagate smoothly to the liquid surface and receive the reflected echoes. A waveguide is installed at the center of the bottom of the water tank to suppress the impact of water flow from all directions, suppress the generation and propagation of waves, and reduce wave amplitude.
[0112] like Figure 3 As shown, Figure 3 Figure (a) in the figure is a schematic diagram comparing the liquid level measurement results before and after using a waveguide. Figure 3 Figure (b) shows a comparison of measurement errors before and after using a waveguide. The attached figure shows liquid level data collected from 0 to 180 seconds, demonstrating the effectiveness of the waveguide and various filtering methods. The evaluation metrics used are RMSE error, peak error, and mean error. Table 1 below provides a detailed comparison of error data before and after using the waveguide:
[0113] Table 1 - Detailed Comparison of Error Data Before and After Using a Wavetone Tube
[0114]
[0115] according to Figure 3 As shown in Table 1, the liquid level signal error was reduced by about 50% after using the waveguide.
[0116] The liquid level measurement system is equipped with a triaxial accelerometer to collect real-time acceleration data of the water tank along three axes, used for dynamic compensation and monitoring of omnidirectional vibration of the water tank. Strain gauges and pressure sensors are installed at the tank's welds, corners, and stress concentration areas. In stress concentration areas, the strain is kept within a certain range, and the strain gauges output relatively stable signals. If a crack appears in the water tank, the stress distribution at the crack location changes, causing a sudden increase in the strain value detected by the strain gauge and triggering an alarm. Combining the changes in the liquid level gauge signal with the signals from the strain gauge and pressure sensors further confirms whether the water tank has cracked and is leaking.
[0117] The level sensor, strain gauge sensor, pressure sensor, and accelerometer are connected to the control system. Taking a PLC as an example, the sensors are connected to the PLC's analog input module via shielded cables, stably transmitting monitoring data to the control system for data processing. A filtering method is written within the control system, as follows:
[0118] First filtering model:
[0119] ,
[0120] in, It is the first filtering model. It is a liquid level signal, and the value of the moving average window is... .
[0121] The second filtering model is as follows:
[0122]
[0123] in, Represents the dynamic damping time constant at the current moment. Minimum damping time constant Maximum damping time constant acceleration acceleration threshold Moving average window according to Rounded to the nearest whole number It is the output signal after dynamic damping adjustment processing. It is a liquid level signal.
[0124] The third filtering model is as follows:
[0125] ,
[0126] in, It is the liquid level difference. It is the sampling frequency.
[0127] ,
[0128] in, This is the second filtering model. For the first filtering model after adjusting the window, This is a liquid level signal. For smoothing coefficients, The size of the sliding window. It is the liquid level difference between time i and time i-1. The first threshold, The second threshold, The standardized weights are calculated using the following formula:
[0129] ;
[0130] .
[0131] when Less than When the liquid level is in the first state (stable state), when lie in and In between, when the liquid level is in the second state (transition state), when ≥ At that time, the liquid level is in the third state (intense state).
[0132] After weighted fusion of the three filtering models, the following composite model is obtained:
[0133] ,
[0134] in, These are the first measurement result, the second measurement result, and the third measurement result, respectively. These represent the mean absolute errors of the three filtering models. For the final measurement result,
[0135] ,
[0136] The size of the error observation window, This represents the reference liquid level at time j within the error observation window. This represents the liquid level measurement result of the i-th filter model at time j. Let it be a very small positive number, and the denominator is guaranteed to be non-zero.
[0137] like Figure 4 As shown, the original signal is a liquid level signal. The graph compares the errors of the first filtering model (traditional filtering), the second filtering model (damping adjustment), the third filtering model (adaptive mode), and the composite model (composite filtering). Specific error data are shown in Table 2 below.
[0138] Table 2 - Comparison of Error Data
[0139]
[0140] From Table 2 and Figure 4 It can be seen that the peak error of the first filtering model is relatively large. The output signal of the dynamic filtering (damping adjustment and adaptive mode) is smooth, stable and close to the real liquid level, indicating that the dynamic filtering has strong adaptive ability and high robustness and can track signal changes in real time.
[0141] like Figure 5 The figure shows a performance comparison of various filtering models. As can be seen from the figure, the dynamic filtering method generally outperforms the static filtering (traditional filtering). The composite filtering algorithm reduces RMSE, peak error, and mean error by approximately 34%, 45.8%, and 37.5% compared to static filtering, and by approximately 27.6%, 17.7%, and 31.4% compared to dynamic filtering. Overall, the composite filtering algorithm has significant advantages in terms of accuracy and stability in liquid level measurement.
[0142] In summary, this embodiment obtains a stable output signal after filtering using the above method, effectively removing noise and interference from the signal. The measured liquid level value is closer to the true value, while reducing signal fluctuations and jumps. This helps the liquid level control system to more accurately judge the liquid level status and avoid malfunctions caused by signal instability. Filtering can optimize the frequency characteristics of the signal, making the liquid level gauge's dynamic response to liquid level changes faster and more accurate. For rapidly changing liquid levels, the filtered signal can reflect the trend of liquid level changes more promptly, helping the system to detect leaks and make adjustments in a timely manner.
[0143] By monitoring the water tank's operating status and sensor outputs through the control system, a drop in the water tank level when the drain valve is closed indicates a leak. If the water tank is in drainage mode, comparing the drainage volume per unit time with the decrease in the water level gauge level determines if a leak has occurred. Further confirmation of the leak and the location of any cracks is then based on signal changes from strain and pressure sensors. This system improves the accuracy and stability of the output signals while accurately monitoring water tank level changes and leaks.
[0144] Example 3:
[0145] Another embodiment of this application relates to a liquid level measuring device. The implementation details of the liquid level measuring device in this embodiment are described below. The following details are provided for ease of understanding and are not essential for implementing this solution. A schematic diagram of the liquid level measuring device in this embodiment can be seen as follows: Figure 6 As shown, it includes an acquisition module 610, a filtering module 620, and a weighted fusion module 630.
[0146] The acquisition module 610 is used to acquire the liquid level signal obtained from the current liquid level monitoring and / or the acceleration of the liquid during movement;
[0147] The filtering module 620 is used to perform at least two of the following filtering processes based on the liquid level signal and / or the acceleration:
[0148] The liquid level signal is processed using a preset first filtering model to obtain a first measurement result of the liquid level. The first filtering model is used to process the liquid level signal using historical liquid level signals within a preset sliding window.
[0149] The size of the sliding window is adjusted according to the acceleration to obtain a second filtering model. The liquid level signal is then processed using the second filtering model to obtain a second measurement result of the liquid level.
[0150] The current liquid level state is determined based on the fluctuation of the liquid level signal. Based on the preset correspondence between the liquid level state and the third filtering model, the third filtering model corresponding to the current liquid level state is determined. The liquid level signal is then processed using the third filtering model to obtain the third measurement result of the liquid level.
[0151] The weighted fusion module 630 is used to weight and fuse at least two of the first measurement result, the second measurement result, and the third measurement result to obtain the final measurement result of the liquid level.
[0152] It is worth mentioning that all modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed in this application; however, this does not mean that other units are absent in this embodiment.
[0153] In some optional embodiments, the filtering module is specifically used for:
[0154] Within a preset damping time constant range, the target damping time constant corresponding to the acceleration is determined based on the ratio of the acceleration to a preset acceleration threshold.
[0155] The target damping time constant is rounded to obtain the adjusted window size.
[0156] In some optional embodiments, the weighted fusion module is specifically used for:
[0157] Within the error observation window, the average absolute error of the corresponding filter model is calculated based on the liquid level results corresponding to at least two filter models and the reference liquid level result. The reference liquid level result is predicted by a preset reference liquid level prediction model. The reference liquid level prediction model is obtained by simulating the liquid level test data obtained by selecting different working conditions on site in advance.
[0158] The reciprocal of the mean absolute error is used as the weight of the corresponding filtering model.
[0159] Example 4:
[0160] Another embodiment of this application relates to an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the liquid level measurement methods in the above embodiments.
[0161] The memory and processor are connected via a bus, which can include any number of interconnecting buses and bridges, connecting various circuits of one or more processors and memories. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which further receives data and transmits it to the processor.
[0162] The processor manages the bus and general processing, and also provides various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory is used to store data used by the processor during operation.
[0163] Example 5:
[0164] Another embodiment of this application relates to a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the method embodiments described above.
[0165] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0166] Those skilled in the art will understand that the above embodiments are specific embodiments for implementing this application, and in practical applications, various changes can be made to them in form and detail without departing from the spirit and scope of this application.
Claims
1. A liquid level measurement method, characterized in that, include: Acquire the liquid level signal obtained from the current liquid level monitoring and the acceleration of the liquid during movement; Based on the liquid level signal and the acceleration, at least two of the following filtering processes are performed: The liquid level signal is processed using a preset first filtering model to obtain a first measurement result of the liquid level. The first filtering model is used to process the liquid level signal using historical liquid level signals within a preset sliding window. The size of the sliding window is adjusted according to the acceleration to obtain a second filtering model. The liquid level signal is then processed using the second filtering model to obtain a second measurement result of the liquid level. The current liquid level state is determined based on the fluctuation of the liquid level signal. Based on the preset correspondence between the liquid level state and the third filtering model, the third filtering model corresponding to the current liquid level state is determined. The liquid level signal is then processed using the third filtering model to obtain the third measurement result of the liquid level. At least two of the first measurement result, the second measurement result, and the third measurement result are weighted and fused to obtain the final measurement result of the liquid level; The magnitude of the acceleration is inversely proportional to the window size, and adjusting the size of the sliding window according to the acceleration includes: Within a preset damping time constant range, the target damping time constant corresponding to the acceleration is determined based on the ratio of the acceleration to a preset acceleration threshold. The target damping time constant is rounded to obtain the adjusted window size.
2. The liquid level measurement method according to claim 1, characterized in that, In the correspondence between the liquid level state and the third filtering model, the more drastic the fluctuation of the liquid level state, the greater the filtering strength of the corresponding third filtering model.
3. The liquid level measurement method according to claim 2, characterized in that, The correspondence between the liquid level state and the third filtering model includes the following: When the liquid level is in the first state, the third filtering model is an exponential smoothing filtering model; When the liquid level is in the second state, the third filtering model is a weighted moving average filtering model, with more recent liquid level signals having a greater weight. When the liquid level is in the third state, the third filtering model is the median filtering model. The intensity of fluctuations in the first state, the second state, and the third state increases sequentially.
4. The liquid level measurement method according to claim 1, characterized in that, When performing weighted fusion of at least two results, weights are assigned to the corresponding filtering models based on the accuracy of each of the at least two filtering models corresponding to the at least two results within a preset error observation window. The higher the accuracy, the greater the corresponding weight.
5. The liquid level measurement method according to claim 4, characterized in that, The step of assigning weights to the corresponding filtering models based on the accuracy of each of the at least two filtering models corresponding to at least two results within a preset error observation window includes: Within the error observation window, the average absolute error of the corresponding filter model is calculated based on the liquid level results corresponding to at least two filter models and the reference liquid level result. The reference liquid level result is predicted by a preset reference liquid level prediction model. The reference liquid level prediction model is obtained by simulating the liquid level test data obtained by selecting different working conditions on site in advance. The reciprocal of the mean absolute error is used as the weight of the corresponding filtering model.
6. A liquid level measuring device, characterized in that, include: The acquisition module is used to acquire the liquid level signal and the acceleration of the liquid movement obtained from the current liquid level monitoring. The filtering module is used to perform at least two of the following filtering processes based on the liquid level signal and the acceleration: The liquid level signal is processed using a preset first filtering model to obtain a first measurement result of the liquid level. The first filtering model is used to process the liquid level signal using historical liquid level signals within a preset sliding window. The size of the sliding window is adjusted according to the acceleration to obtain a second filtering model. The liquid level signal is then processed using the second filtering model to obtain a second measurement result of the liquid level. The current liquid level state is determined based on the fluctuation of the liquid level signal. Based on the preset correspondence between the liquid level state and the third filtering model, the third filtering model corresponding to the current liquid level state is determined. The liquid level signal is then processed using the third filtering model to obtain the third measurement result of the liquid level. The weighted fusion module is used to weight and fuse at least two of the first measurement result, the second measurement result, and the third measurement result to obtain the final measurement result of the liquid level; The magnitude of the acceleration is inversely proportional to the window size, and the filtering module is specifically used for: Within a preset damping time constant range, the target damping time constant corresponding to the acceleration is determined based on the ratio of the acceleration to a preset acceleration threshold. The target damping time constant is rounded to obtain the adjusted window size.
7. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the liquid level measurement method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the liquid level measurement method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Hydropower station expansion tank water level prediction alarm method and system
CN120726779A
Liquid level monitoring method and system for expansion water tank
CN120831159A
Method and system for filtering noise of liquid level measurements from a reservoir
US20160003666A1
