Online real-time liquid level sensor liquid level height measurement method and system
By filtering and fitting the triangular wave and linear wave signals of the liquid level sensor, combined with the inflection point determination algorithm, the liquid level height is calculated in real time, which solves the problem of liquid level height measurement error in the existing technology, and achieves high-precision and real-time liquid level height measurement.
Patent Information
- Application Number
- CN202510000506.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2045-01-02
AI Technical Summary
Existing liquid level sensors cannot accurately measure liquid level height when the ambient temperature changes, resulting in accumulated measurement errors, and the liquid level height error calculated by linear wave voltage signals is relatively large.
By filtering the triangular wave voltage signal and linear wave voltage signal of the liquid level sensor, combined with local linear fitting and inflection point determination algorithm, the liquid level height is calculated in real time to reduce the impact of ambient temperature changes on the dielectric constant.
Real-time and accurate liquid level height measurement is achieved, which reduces measurement errors caused by temperature changes and avoids the accumulation of linear wave voltage signal calculation errors.
Smart Images

Figure CN119394405B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sensor signal processing. Specifically, it relates to a method and system for measuring the liquid level height of an on-line real-time liquid level sensor. More specifically, it relates to a method and system for calculating the liquid level height by comprehensively using the triangular wave voltage signal and the linear wave voltage signal of a segmented capacitance sensor. Background Art
[0002] Currently, a segmented capacitance sensor is generally selected for measuring the liquid level height of the on-board storage tank. During the filling process of the storage tank, due to the change in ambient temperature, the dielectric constant of the filling liquid will change, which will further affect the liquid level height of the storage tank. In the existing method, according to the filling environment, the dielectric constant of the filling liquid is predicted before filling, and the same dielectric constant is used throughout the filling process to calculate the liquid level height. When the ambient temperature changes during the filling process, the traditional method cannot accurately measure the liquid level height, which will bring relatively large measurement errors in the liquid level height.
[0003] Currently, in the method for processing the liquid level height of a liquid level sensor, the linear wave voltage signal is used to calculate the liquid level height throughout the filling process. The error in the liquid level height calculated by the linear wave voltage signal will accumulate throughout the process, resulting in an increasing error in the liquid level height after the segmentation of the segmented capacitance sensor.
[0004] Currently, in the method for processing the liquid level height of a liquid level sensor, the average filtering method is used for the triangular wave voltage value and the linear wave voltage value. When more values are selected for average filtering in order to obtain a better filtering effect, the filtered value is relatively smooth, but there will be a delay.
[0005] The existing method is relatively simple and reliable to implement, and there will be no measurement errors caused by misjudging the number of segments of the liquid level sensor. The error mainly lies in the change in the dielectric constant of the medium caused by the change in ambient temperature, the measurement accuracy is low, and the error will accumulate throughout the process, without considering the influence of the change in the triangular wave voltage signal on the liquid level height. Summary of the Invention
[0006] Aiming at the defects in the prior art, the purpose of the present invention is to provide a method and system for measuring the liquid level height of an on-line real-time liquid level sensor.
[0007] According to a method for measuring the liquid level height of an on-line real-time liquid level sensor provided by the present invention, it includes:
[0008] Step S1: Filter the liquid level signals of the liquid level sensor, including the triangular wave voltage signal and the linear wave voltage signal, to obtain the filtered triangular wave voltage signal and linear wave voltage signal;
[0009] Step S2: Based on the slope of the locally linear fitting of the linear wave voltage signal after filtering, determine whether the current tank is in the filling mode or the consumption mode.
[0010] Step S3: For the triangular wave voltage signal after filtering, use the inflection point determination algorithm to obtain the maximum voltage value and the minimum voltage value of the triangular wave voltage.
[0011] Step S4: Determine the number of sections of the current liquid level sensor according to the mode of the current tank, and use the filtered triangular wave voltage signal, the number of sections of the liquid level sensor, and the maximum voltage value and the minimum voltage value of the triangular wave voltage to calculate the liquid level height.
[0012] Preferably, the step S1 includes:
[0013] Step S1.1: Filter the liquid level signals of the liquid level sensor, including the triangular wave voltage signal and the linear wave voltage signal, by using the weighted sliding filtering method.
[0014] Step S1.2: Use the least squares method to perform local linear fitting on the filtered triangular wave and linear wave voltage signals to obtain the filtered triangular wave voltage signal and the linear wave voltage signal.
[0015] Preferably, the step S1.1 includes:
[0016] The size of the sliding window is SlideN, where SlideN is an integer multiple of 4. When the number of received data is less than the size of the sliding window, the current number of data is n, and the data set , and the direct average method is used. The filtered value is calculated as:
[0017]
[0018] When the received data is greater than or equal to the size of the sliding window, the data set , and the weighted sliding average method is adopted. The sliding window data set is divided into 4 equal parts, and the size of each equal part is . The data sets after the sliding window data is equally divided are , , and :
[0019]
[0020]
[0021]
[0022]
[0023] Perform weighted averaging on the data within the sliding window, and the dataset result The corresponding weight is and the dataset The corresponding weight is and the dataset The corresponding weight is and the dataset The corresponding weight is , and the value after filtering The calculation formula is:
[0024] .
[0025] Preferably, the step S1.2 includes:
[0026] When the number of received filtered data is less than the fitting sliding interval size fitN = SlideN, no fitting operation is performed, and the current value is directly returned;
[0027] When the number of received filtered data is greater than or equal to the fitting sliding interval size fitN, least squares fitting is performed, and the dataset in the fitting interval , where represents the data sequence number, represents the corresponding filtered data value. Map the dataset F to a dataset starting from the origin (0, 0), then , and use the least squares method to calculate the slope k and b in the linear regression equation of the fitting sliding interval:
[0028]
[0029]
[0030] Then use the fitted slope to compensate the data to make up for the lag phenomenon caused by the previous weighted moving average filter to the dataset. Assume the compensation coefficient is , then the signal data after fitting compensation The calculation formula is:
[0031] .
[0032] Preferably, the step S2 includes: judging the current processing working mode through the rising or falling trend of the linear wave;
[0033] When the linear wave fitting slope K_linear continuously appears with N values greater than or equal to 0, it is considered that the storage tank is in the filling mode, otherwise when the linear wave fitting slope K_linear continuously has N values less than 0, it is considered that the storage tank is in the consumption mode;
[0034] When the storage tank is in the filling mode, the medium in the storage tank is increasing; when the storage tank is in the consumption mode, the medium in the storage tank is decreasing.
[0035] Preferably, the step S3 includes:
[0036] When the triangular wave voltage value is within the threshold range for finding the maximum value, record a current maximum value. When it is detected that the current maximum value minus the current value of the triangular wave voltage is greater than the height difference threshold Q for N consecutive times, it is determined that the maximum value of the triangular wave voltage value has been found;
[0037] When the triangular wave voltage value is within the threshold range for finding the minimum value, record a current minimum value. When it is detected that the current value of the triangular wave voltage minus the current minimum value is greater than the height difference threshold Q for N consecutive times, it is determined that the minimum value of the triangular wave voltage value has been found.
[0038] Preferably, the step S4 includes:
[0039] Step S4.1: Modify the number of sensor sections according to the current mode of the storage tank; when the working mode is the filling mode, the number of sensor sections is decreased by 1; when the working mode is the consumption mode, the number of sensor sections is increased by 1;
[0040] Step S4.2: Select the corresponding liquid level height calculation formula based on the parity of the number of sensor sections and the current triangular wave voltage value, and calculate the liquid level height;
[0041] When the number of sections of the liquid level sensor is odd and minus is greater than 0, the liquid level height calculation formula is:
[0042]
[0043] Where, represents the liquid level height calculated by the triangular wave, represents the current voltage value after triangular wave filtering and fitting, represents the current minimum value of the triangular wave, represents the current maximum value of the triangular wave; U represents the length of a single sensor section; S represents the total number of bound sensor sections; s represents the current sensor section number; D represents the dead zone length;
[0044] When the number of sections of the liquid level sensor is odd and minus is less than or equal to 0, the liquid level height calculation formula is:
[0045]
[0046] When the number of sections of the liquid level sensor is even and minus When it is greater than 0, the calculation formula for the liquid level height is:
[0047]
[0048] When the number of sections of the liquid level sensor is an even number and when minus When it is less than or equal to 0, the calculation formula for the liquid level height is:
[0049] .
[0050] An on-line real-time liquid level sensor liquid level height measurement system provided by the present invention includes:
[0051] Module M1: Filter the liquid level signals of the liquid level sensor, including triangular wave voltage signals and linear wave voltage signals, to obtain the filtered triangular wave voltage signals and linear wave voltage signals;
[0052] Module M2: For the filtered linear wave voltage signal, determine whether the current storage tank is in the filling mode or the consumption mode according to the slope of local linear fitting;
[0053] Module M3: For the filtered triangular wave voltage signal, use the inflection point determination algorithm to obtain the maximum voltage value and the minimum voltage value of the triangular wave voltage value;
[0054] Module M4: Determine the number of sections of the current liquid level sensor according to the mode of the current storage tank, and use the filtered triangular wave voltage signal, the number of sections of the liquid level sensor, and the maximum voltage value and the minimum voltage value of the triangular wave voltage value to calculate the liquid level height.
[0055] Preferably, the module M1 includes:
[0056] Module M1.1: Filter the liquid level signals of the liquid level sensor, including triangular wave voltage signals and linear wave voltage signals, by using the weighted sliding filtering method;
[0057] The size of the sliding window is SlideN, where SlideN is an integer multiple of 4. When the number of received data is less than the size of the sliding window, the current number of data is n, and the data set , using the direct averaging method, the filtered value The calculation formula is:
[0058]
[0059] When the received data is greater than or equal to the size of the sliding window, the data set , using the weighted sliding average method, the sliding window data set is divided into 4 equal parts, each of which is , the data sets after the sliding window data is equally divided are , , as well as :
[0060]
[0061]
[0062]
[0063]
[0064] Perform weighted averaging on the data in the sliding window, and the data set results The corresponding weight is , Dataset The corresponding weight is , Dataset The corresponding weight is , Dataset The corresponding weight is , the filtered value The calculation formula is:
[0065]
[0066] Module M1.2: Use the least square method to perform local linear fitting on the filtered triangular wave and linear wave voltage signals to obtain the filtered triangular wave voltage signals and linear wave voltage signals;
[0067] When the number of filtered data is less than the fitting sliding interval size fitN=SlideN, no fitting operation is performed and the current value is returned directly;
[0068] When the number of filtered data is greater than or equal to the fitting sliding interval size fitN, the least squares fitting is performed to fit the interval data set. ,in, Represents the data sequence number, Represents the corresponding filtered data value, and maps the data set F to a data set starting from the origin (0, 0). , use the least squares method to calculate the slope k and b in the linear regression equation of the fitting sliding interval:
[0069]
[0070]
[0071] Then, the compensated data is processed using the fitted slope to make up for the lag phenomenon caused by the previous weighted moving average filtering to the data set. Assuming the compensation coefficient is , the signal data after fitting compensation The calculation formula is:
[0072] .
[0073] Preferably, the module M2 includes: judging the current processing working mode through the rising or falling trend of the linear wave;
[0074] When the linear wave fitting slope K_linear continuously appears with N values greater than or equal to 0, it is considered that the storage tank is in the filling mode; otherwise, when the linear wave fitting slope K_linear continuously has N values less than 0, it is considered that the storage tank is in the consumption mode;
[0075] When the storage tank is in the filling mode, the medium in the storage tank is increasing; when the storage tank is in the consumption mode, the medium in the storage tank is decreasing;
[0076] The module M3 includes:
[0077] When the triangular wave voltage value is within the threshold range for finding the maximum value, record a current maximum value. When it is detected that the current maximum value minus the current value of the triangular wave voltage is greater than the height difference threshold Q for N consecutive times, it is determined that the maximum value of the triangular wave voltage is found;
[0078] When the triangular wave voltage value is within the threshold range for finding the minimum value, record a current minimum value. When it is detected that the current value of the triangular wave voltage minus the current minimum value is greater than the height difference threshold Q for N consecutive times, it is determined that the minimum value of the triangular wave voltage is found;
[0079] The module M4 includes:
[0080] Module M4.1: Modify the number of sensor sections according to the current mode of the storage tank; when the working mode is the filling mode, the number of sensor sections is decreased by 1; when the working mode is the consumption mode, the number of sensor sections is increased by 1;
[0081] Module M4.2: Select the corresponding liquid level height calculation formula based on the parity of the number of sensor sections and the current voltage value of the triangular wave, and calculate the liquid level height;
[0082] When the number of liquid level sensor sections is an odd number and minus is greater than 0, the liquid level height calculation formula is:
[0083]
[0084] Wherein, Indicates the liquid level height calculated by the triangular wave, Indicates the voltage value after filtering and fitting the current triangular wave, Indicates the minimum value of the current triangular wave, Indicates the maximum value of the current triangular wave; U represents the single-section length of the sensor; S represents the total number of sensor sections bound; s represents the current sensor section; D represents the dead zone length;
[0085] When the number of sections of the liquid level sensor is odd and minus is less than or equal to 0, the liquid level height calculation formula is:
[0086]
[0087] When the number of sections of the liquid level sensor is even and minus is greater than 0, the liquid level height calculation formula is:
[0088]
[0089] When the number of sections of the liquid level sensor is even and when minus is less than or equal to 0, the liquid level height calculation formula is:
[0090] .
[0091] Compared with the prior art, the present invention has the following beneficial effects:
[0092] 1. The present invention can real-time eliminate the data burrs. The method of weighted sliding filtering combined with local linear fitting can smooth the liquid level signal, and at the same time ensure high real-time data and no delay problem;
[0093] 2. The present invention can online real-time find the inflection point of the triangular wave voltage value. Under the premise of considering the data characteristics, the inflection point determination algorithm selects the appropriate continuous number N and height difference threshold Q. The inflection point determination algorithm has a high correct rate of finding the inflection point and a small delay of the found inflection point;
[0094] 3. When calculating the liquid level height, the present invention uses the extreme value at the inflection point of the triangular wave found in real time, which reduces the influence of environmental temperature change on the capacitance, that is, reduces the error of liquid level height measurement caused by the change of dielectric constant; at the same time, using the triangular wave to calculate the liquid level height can avoid the cumulative error of the whole process brought by using the linear wave voltage value to calculate the liquid level height, and improves the measurement accuracy of the liquid level height. Brief Description of the Drawings
[0095] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments read in conjunction with the accompanying drawings:
[0096] Figure 1 The figure shows a flowchart of a method for measuring the liquid level height of an online real-time liquid level sensor of the present invention.
[0097] Figure 2 The figure shows a schematic diagram of the change curve of the liquid level sensor signal of the present invention over time.
[0098] Figure 3 The figure shows a flowchart of a method for calculating and processing the liquid level height of the present invention. Detailed Embodiments
[0099] The present invention will be described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but do not limit the present invention in any form. It should be noted that those of ordinary skill in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.
[0100] Embodiment 1
[0101] An online real-time liquid level sensor liquid level height measurement method and system provided by the present invention is an online real-time highly reliable method for finding the inflection point of a triangular wave voltage signal and calculating the liquid level height according to the triangular wave voltage signal.
[0102] The online real-time liquid level sensor liquid level height measurement method, as Figure 1 shown, includes the following steps:
[0103] Step 1: Filter the liquid level signals of the liquid level sensor, including triangular wave voltage signals and linear wave voltage signals, to eliminate the jitter and burrs of the triangular wave voltage signals and linear wave voltage signals, thereby obtaining a stable value.
[0104] Specifically, the filtering algorithm is as follows: The weighted sliding filtering method is used to filter the original data, and then local linear fitting is performed to finally obtain the filtered triangular wave voltage value and linear wave voltage value;
[0105] More specifically, the sliding window size is SlideN, where SlideN is an integer multiple of 4. When the number of received data is less than the size of the sliding window, the current number of data is n, and the data set , using the direct averaging method, the filtered value The calculation formula of is:
[0106]
[0107] When the received data is greater than or equal to the size of the sliding window, the data set , adopt the method of weighted moving average, divide the sliding window data set into 4 equal parts, and the size of each equal part is . The data sets after the sliding window data is equally divided are respectively 、 、 and :
[0108]
[0109]
[0110]
[0111]
[0112] Perform weighted average on the data within the sliding window, and the data set result The corresponding weight is , data set The corresponding weight is , data set The corresponding weight is , data set The corresponding weight is . The calculation formula of the filtered value is:
[0113] .
[0114] When the number of received filtered data is less than the fitting sliding interval size fitN = SlideN, no fitting operation is performed, and the current value is directly returned;
[0115] When the number of received filtered data is greater than or equal to the fitting sliding interval size fitN, perform least squares fitting, and the data set of the fitting interval , where represents the data serial number, represents the corresponding filtered data value. Map the data set F to a data set starting from the origin (0, 0), then . Use the least squares method to calculate the slope k and b in the linear regression equation of the fitting sliding interval:
[0116]
[0117]
[0118] Then, use the fitted slope to compensate the data to make up for the lag phenomenon caused by the previous weighted moving average filtering to the data set. Assume the compensation coefficient is , then the signal data after fitting compensation has the following calculation formula:
[0119] .
[0120] Step 2: According to the linear wave voltage value after the above filtering and the slope of the local linear fitting, determine whether the current storage tank is in the filling mode or the consumption mode; the filling mode is to increase the medium, and the consumption mode is to reduce the medium;
[0121] Specifically, when the local fitting slope value of the linear wave voltage value is greater than 0, it is determined that the current is in the filling mode; when the local fitting slope of the linear wave voltage value is less than 0, it is determined that the current is in the consumption mode;
[0122] Step 3: According to the triangular wave voltage value after the above filtering, adopt the inflection point determination algorithm to obtain the maximum voltage value and the minimum voltage value of the triangular wave voltage value;
[0123] Specifically, for the inflection point determination algorithm to find the maximum value: when the triangular wave voltage value is within the threshold range for finding the maximum value, the algorithm needs to record a current maximum value. When it is detected that the current maximum value minus the current value of the triangular wave voltage is greater than the height difference threshold Q for N consecutive times, it is determined that the maximum value of the triangular wave voltage value is found, that is, the inflection point of the maximum value of the triangular wave voltage is found;
[0124] For the inflection point determination algorithm to find the minimum value: when the triangular wave voltage value is within the threshold range for finding the minimum value, the algorithm needs to record a current minimum value. When it is detected that the current value of the triangular wave voltage minus the current minimum value is greater than the height difference threshold Q for N consecutive times, it is determined that the minimum value of the triangular wave voltage value is found, that is, the inflection point of the minimum value of the triangular wave voltage is found;
[0125] Furthermore, the number of consecutive times N is determined by the frequency of obtaining the liquid level signal data. When the receiving frequency of the liquid level data is 20 Hz, the value of the number of consecutive times N is [1, 20].
[0126] Furthermore, the meaning of the height difference threshold Q is the difference between the extreme point (i.e., the extreme value point, the maximum value point or the minimum value point) and the current triangular wave liquid level voltage value when the inflection point appears; the value of the height difference threshold affects the accuracy of finding the inflection point and the speed of finding the inflection point;
[0127] Step 4: After finding the extreme point of the triangular wave voltage value, on the one hand, it is necessary to update the maximum or minimum value corresponding to the current dielectric constant, and on the other hand, it is necessary to modify the number of sections where the liquid level sensor is located according to the current mode of the storage tank;
[0128] Specifically, when the storage tank is in the filling mode, after finding the extreme point, it is necessary to reduce the number of sections of the liquid level sensor; when the storage tank is in the consumption mode, after finding the extreme point, it is necessary to increase the number of sections of the liquid level sensor;
[0129] When calculating the liquid level height using the triangular wave voltage value, different calculation formulas for the liquid level height are selected according to the number of sections of the liquid level sensor; assume that the value after triangular wave filtering compensation is , the minimum value of the triangular wave is (the minimum value of the bound triangular wave in the initial case, and the minimum value of the found triangular wave later), the maximum value of the triangular wave is (the maximum value of the bound triangular wave in the initial case, and the maximum value of the found triangular wave later), the bound number of sensor sections is S, the dead zone length is D, the single-section length is U, the current number of sensor sections is s, and the liquid level height calculated by the triangular wave is ;
[0130] When the number of sections of the liquid level sensor is an odd number and minus is greater than 0, the liquid level height calculation formula is:
[0131]
[0132] When the number of sections of the liquid level sensor is an odd number and minus is less than or equal to 0, the liquid level height calculation formula is:
[0133]
[0134] When the number of sections of the liquid level sensor is an even number and minus is greater than 0, the liquid level height calculation formula is:
[0135]
[0136] When the number of sections of the liquid level sensor is an even number and when minus is less than or equal to 0, the liquid level height calculation formula is:
[0137] .
[0138] The present invention also provides an online real-time liquid level sensor liquid level height measurement system, which can be implemented by executing the process steps of the online real-time liquid level sensor liquid level height measurement method. That is, those skilled in the art can understand the online real-time liquid level sensor liquid level height measurement method as a preferred implementation manner of the online real-time liquid level sensor liquid level height measurement system.
[0139] Embodiment 2
[0140] Embodiment 2 is a preferred example of Embodiment 1.
[0141] As Figure 2 、 3 shown, an online real-time liquid level sensor liquid level height measurement method of the present invention includes:
[0142] Filter the triangular wave and linear wave of the liquid level signal.
[0143] Judge the current working mode according to the rising or falling trend of the linear wave. When the liquid level in the storage tank is increasing, it is the filling mode, and when the liquid level in the storage tank is decreasing, it is the consumption mode.
[0144] Find the extreme points (including the maximum and minimum values) of the triangular wave, correct the section where the liquid level sensor is located, and use the extreme values to correct the parameters in the liquid level height calculation formula.
[0145] Calculate the liquid level height of the storage tank according to the section where the sensor is located.
[0146] In a specific embodiment, a schematic diagram of the liquid level sensor liquid level signal changing with time is as Figure 2 shown. The numbers 1-6 in the figure represent the current sections of the sensor. 1 represents the first section, 2 represents the second section, 3 represents the third section, 4 represents the fourth section, 5 represents the fifth section, and 6 represents the sixth section.
[0147] In a specific embodiment, when filtering the triangular wave and linear wave, a weighted sliding filtering method is used for preliminary filtering. For the preliminarily filtered triangular wave and linear wave, the least squares method is used to fit the linear regression of the sliding window interval, and the slope K_tri and offset b_tri of the triangular wave voltage linear wave regression equation, and the slope K_linear and offset b_linear of the linear wave regression equation are calculated.
[0148] In a specific implementation method, judge the current working mode according to the rising or falling trend of the linear wave. When the fitting slope K_linear of the linear wave continuously appears N (number of continuous times) values greater than or equal to 0, it is considered that the storage tank is in the filling mode, otherwise when K_linear continuously appears N values less than 0, it is considered that the storage tank is in the consumption mode.
[0149] To find the maximum value of the triangular wave, this embodiment uses the height difference of the triangular wave to find the maximum value. The method will set a region for finding the maximum value. When the triangular wave exceeds this maximum value threshold, the operation of finding the maximum value is carried out. The filtered triangular wave is used to find the extreme value, and a historical maximum value of the triangular wave is recorded. When it is detected that the difference between the recorded maximum value and the current triangular wave voltage value is greater than the height difference threshold of 0.2 for N consecutive times, it is determined that the maximum value of the triangular wave voltage is found, that is, the inflection point of the maximum value of the triangular wave voltage is found;
[0150] To find the minimum value of the triangular wave, the method described in this article uses the height difference of the triangular wave to find the minimum value. The method will set a region for finding the minimum value. When the triangular wave is less than this minimum value threshold, the operation of finding the minimum value is carried out. The filtered triangular wave is used to find the minimum value, and a historical minimum value of the triangular wave is recorded. When it is detected that the difference between the current value of the triangular wave voltage and the current minimum value is greater than the height difference threshold of 0.2 for N consecutive times, it is determined that the minimum value of the triangular wave voltage is found, that is, the inflection point of the minimum value of the triangular wave voltage is found;
[0151] In the specific implementation method, after finding the extreme point of the triangular wave, that is, the maximum or minimum value of the triangular wave, according to the current working mode, the number of sensor sections is modified. If the current working mode is the filling mode, the number of sensor sections is reduced by 1. If the current working mode is the consumption mode, the number of sensor sections is increased by 1;
[0152] Specifically, when finding the extreme points of the triangular wave, that is, the maximum value and the minimum value of the triangular wave, the maximum value and the minimum value in the liquid level height calculation formula are updated to improve the calculation accuracy of the liquid level height;
[0153] Furthermore, according to the current number of sensor sections, the corresponding formula is selected to calculate the liquid level height. For details, see Figure 3 : When the number of sections of the liquid level sensor is an odd number and minus is greater than 0, the liquid level height calculation formula is:
[0154]
[0155] where is the liquid level height calculated by the triangular wave, is the value of the current triangular wave after filtering, is the current minimum value of the triangular wave, is the current maximum value of the triangular wave, U is the length of a single sensor section, S is the total number of bound sensor sections, s is the current sensor section number, and D is the dead zone length;
[0156] When the number of sections of the liquid level sensor is an odd number and minus When it is less than or equal to 0, the liquid level height calculation formula is:
[0157]
[0158] When the number of sections of the liquid level sensor is an even number and minus When it is greater than 0, the liquid level height calculation formula is:
[0159]
[0160] When the number of sections of the liquid level sensor is an even number and when minus When it is less than or equal to 0, the liquid level height calculation formula is:
[0161] 。
[0162] Those skilled in the art know that in addition to implementing the system and its various devices, modules, and units provided by the present invention in the form of pure computer-readable program code, the method steps can be logically programmed to enable the system and its various devices, modules, and units provided by the present invention to be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers, etc. to achieve the same functions. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a kind of hardware component, and the devices, modules, and units included therein for implementing various functions can also be regarded as the structures within the hardware component; the devices, modules, and units for implementing various functions can also be regarded as either software modules for implementing the method or the structures within the hardware component.
[0163] The specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. Without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. An online real-time liquid level sensor liquid level height measurement method, characterized in that: include: Step S1: filtering the liquid level signal of the liquid level sensor including the triangular wave voltage signal and the linear wave voltage signal to obtain the triangular wave voltage signal and the linear wave voltage signal after filtering; Step S2: After filtering, the linear wave voltage signal is used to determine whether the current tank mode is a filling mode or a consumption mode according to the slope of the local linear fitting; Step S3: using an inflection point determination algorithm to obtain a maximum voltage value and a minimum voltage value of the triangular wave voltage value from the triangular wave voltage signal after filtering; Step S4: Determine the number of sections of the current liquid level sensor according to the current mode of the storage tank, and calculate the liquid level height using the filtered triangular wave voltage signal, the number of sections of the liquid level sensor, and the maximum voltage value and the minimum voltage value of the triangular wave voltage value; The step S1 comprises: Step S1.1: filtering the liquid level signal of the liquid level sensor including the triangular wave voltage signal and the linear wave voltage signal by using a weighted sliding filtering method; Step S1.2: performing local linear fitting on the filtered triangular wave and linear wave voltage signals using the least square method to obtain filtered triangular wave voltage signals and linear wave voltage signals; The step S1.1 comprises: The sliding window size is SlideN, where SlideN is an integer multiple of 4. When the number of received data is less than the size of the sliding window, the current number of data is n, and the data set , using the direct averaging method, the filtered value The calculation formula is: When the received data is greater than or equal to the size of the sliding window, the data set , using the weighted sliding average method, the sliding window data set is divided into 4 equal parts, each of which is , the data sets after the sliding window data is equally divided are , , as well as : Perform weighted averaging on the data in the sliding window, and the data set results The corresponding weight is , Dataset The corresponding weight is , Dataset The corresponding weight is , Dataset The corresponding weight is , the filtered value The calculation formula is: ; The step S1.2 comprises: When the number of filtered data is less than the fitting sliding interval size fitN=SlideN, no fitting operation is performed and the current value is returned directly; When the number of filtered data is greater than or equal to the fitting sliding interval size fitN, the least squares fitting is performed to fit the interval data set. ,in, Represents the data sequence number, Represents the corresponding filtered data value, and maps the data set F to a data set starting from the origin (0, 0). , use the least squares method to calculate the slope k and b in the linear regression equation of the fitting sliding interval: Then use the fitted slope to compensate the data to make up for the lag caused by the previous weighted moving average filter on the data set. Assume that the compensation coefficient is , then the signal data after fitting compensation The calculation formula is: ; The step S3 comprises: When the triangular wave voltage value is within the threshold range for finding the maximum value, a current maximum value is recorded. When it is detected that the current maximum value minus the current value of the triangular wave voltage is greater than the height difference threshold Q for N consecutive times, it is determined that the maximum value of the triangular wave voltage value is found; When the triangular wave voltage value is within the threshold range for finding the minimum value, a current minimum value is recorded. When it is detected that the current value of the triangular wave voltage minus the current minimum value is greater than the height difference threshold Q for N consecutive times, it is determined that the minimum value of the triangular wave voltage value is found; The step S4 comprises: Step S4.1: modify the number of sensor nodes according to the current mode of the tank; when the working mode is the filling mode, the number of sensor nodes is reduced by 1; when the working mode is the consumption mode, the number of sensor nodes is increased by 1; Step S4.2: Select the corresponding liquid level calculation formula according to the parity of the number of sensor nodes and the current voltage value of the triangle wave to calculate the liquid level; When the number of sections of the liquid level sensor is an odd number and reduce When it is greater than 0, the liquid level calculation formula is: in, Indicates the liquid level calculated by triangular wave, Indicates the voltage value after the current triangle wave filter fitting. Indicates the current minimum value of the triangle wave. Indicates the current maximum value of the triangle wave; U indicates the length of a single sensor section; S indicates the total number of bound sensor sections; s indicates the current number of sensor sections; D indicates the dead zone length; When the number of sections of the liquid level sensor is an odd number and reduce When it is less than or equal to 0, the liquid level calculation formula is: When the number of nodes of the liquid level sensor is an even number and reduce When it is greater than 0, the calculation formula for the liquid level is: When the number of nodes of the liquid level sensor is an even number and when reduce When it is less than or equal to 0, the calculation formula of liquid level is: 。 2. The method for measuring liquid level height using an online real-time liquid level sensor according to claim 1, characterized in that: The step S2 includes: judging the current processing working mode by the rising or falling trend of the linear wave; When the linear wave fitting slope K_linear has N consecutive values greater than or equal to 0, it is considered that the tank is in the filling mode; otherwise, when the linear wave fitting slope K_linear has N consecutive values less than 0, it is considered that the tank is in the consumption mode; When the tank is in the filling mode, the medium in the tank is increasing; when the tank is in the consumption mode, the medium in the tank is decreasing.
3. An online real-time liquid level sensor liquid level height measurement system, characterized in that: include: Module M1: filtering the liquid level signal of the liquid level sensor including the triangular wave voltage signal and the linear wave voltage signal to obtain the triangular wave voltage signal and the linear wave voltage signal after filtering; Module M2: The linear wave voltage signal after filtering is used to determine whether the current tank mode is a filling mode or a consumption mode according to the slope of the local linear fitting; Module M3: After filtering, the triangular wave voltage signal uses an inflection point determination algorithm to obtain the maximum voltage value and the minimum voltage value of the triangular wave voltage value; Module M4: Determine the number of sections of the current liquid level sensor according to the current mode of the tank, and calculate the liquid level using the filtered triangular wave voltage signal, the number of sections of the liquid level sensor, and the maximum and minimum voltage values of the triangular wave voltage value; The module M1 comprises: Module M1.1: The liquid level signal of the liquid level sensor, including the triangular wave voltage signal and the linear wave voltage signal, is filtered by using the weighted sliding filtering method; The sliding window size is SlideN, where SlideN is an integer multiple of 4. When the number of received data is less than the size of the sliding window, the current number of data is n, and the data set , using the direct averaging method, the filtered value The calculation formula is: When the received data is greater than or equal to the size of the sliding window, the data set , using the weighted sliding average method, the sliding window data set is divided into 4 equal parts, each of which is , the data sets after the sliding window data is equally divided are , , as well as : Perform weighted averaging on the data in the sliding window, and the data set results The corresponding weight is , Dataset The corresponding weight is , Dataset The corresponding weight is , Dataset The corresponding weight is , the filtered value The calculation formula is: Module M1.2: Use the least square method to perform local linear fitting on the filtered triangular wave and linear wave voltage signals to obtain the filtered triangular wave voltage signals and linear wave voltage signals; When the number of filtered data is less than the fitting sliding interval size fitN=SlideN, no fitting operation is performed and the current value is returned directly; When the number of filtered data is greater than or equal to the fitting sliding interval size fitN, the least squares fitting is performed to fit the interval data set. ,in, Represents the data sequence number, Represents the corresponding filtered data value, and maps the data set F to a data set starting from the origin (0, 0). , use the least squares method to calculate the slope k and b in the linear regression equation of the fitting sliding interval: Then use the fitted slope to compensate the data to make up for the lag caused by the previous weighted moving average filter on the data set. Assume that the compensation coefficient is , then the signal data after fitting compensation The calculation formula is: ; The module M3 comprises: When the triangular wave voltage value is within the threshold range for finding the maximum value, a current maximum value is recorded. When it is detected that the current maximum value minus the current value of the triangular wave voltage is greater than the height difference threshold Q for N consecutive times, it is determined that the maximum value of the triangular wave voltage value is found; When the triangular wave voltage value is within the threshold range for finding the minimum value, a current minimum value is recorded. When it is detected that the current value of the triangular wave voltage minus the current minimum value is greater than the height difference threshold Q for N consecutive times, it is determined that the minimum value of the triangular wave voltage value is found; The module M4 comprises: Module M4.1: Modify the number of sensor nodes according to the current mode of the tank; when the working mode is the filling mode, the number of sensor nodes is reduced by 1; when the working mode is the consumption mode, the number of sensor nodes is increased by 1; Module M4.2: According to the parity of the number of sensor nodes and the current voltage value of the triangle wave, select the corresponding liquid level calculation formula to calculate the liquid level; When the number of sections of the liquid level sensor is an odd number and reduce When it is greater than 0, the liquid level calculation formula is: in, Indicates the liquid level calculated by triangular wave, Indicates the voltage value after the current triangle wave filter fitting. Indicates the current minimum value of the triangle wave. Indicates the current maximum value of the triangle wave; U indicates the length of a single sensor section; S indicates the total number of bound sensor sections; s indicates the current number of sensor sections; D indicates the dead zone length; When the number of sections of the liquid level sensor is an odd number and reduce When it is less than or equal to 0, the liquid level calculation formula is: When the number of nodes of the liquid level sensor is an even number and reduce When it is greater than 0, the calculation formula for the liquid level is: When the number of nodes of the liquid level sensor is an even number and when reduce When it is less than or equal to 0, the calculation formula of liquid level is: 。 4. The online real-time liquid level sensor liquid level height measurement system according to claim 3 is characterized in that: The module M2 includes: judging the current processing working mode by the rising or falling trend of the linear wave; When the linear wave fitting slope K_linear has N consecutive values greater than or equal to 0, it is considered that the tank is in the filling mode; otherwise, when the linear wave fitting slope K_linear has N consecutive values less than 0, it is considered that the tank is in the consumption mode; When the tank is in the filling mode, the medium in the tank is increasing; when the tank is in the consumption mode, the medium in the tank is decreasing.
Citation Information
Patent Citations
Method and device for liquid level measurement based on sectional capacitor, and electronic device
CN108362355A
Liquid level height analysis method, device and system, equipment and storage medium
CN112798077A