Liquid level detection method with multiple sampling needles
Through the combination of adaptive algorithms and filtering algorithms, the liquid level detection parameters are dynamically adjusted and noise interference is suppressed, which solves the problems of low accuracy and poor stability of the existing liquid level detection methods, and achieves high-precision and high-stability liquid level detection.
Patent Information
- Application Number
- CN202510093479.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-04-25
AI Technical Summary
The existing liquid level detection methods are susceptible to environmental factors, have low detection accuracy, poor stability, and have mutual interference problems in the environment of multiple sample needles.
Adaptive algorithm is used to dynamically adjust the capacitance measurement parameters, combine the filtering algorithm to filter out abnormal data of capacitance value, and suppress noise and interference by dynamically adjusting the weight matrix to ensure the accuracy and stability of liquid level detection.
It improves the accuracy and stability of liquid level detection, effectively suppresses noise and multi-needle interference, and adapts to environmental changes and multi-needle working state.
Smart Images

Figure CN119880093A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of liquid level detection methods, and in particular relates to a multi-sample needle liquid level detection method. Background Art
[0002] In medical automation equipment, liquid level detection technology is the key to ensure experimental accuracy and repeatability. Liquid level detection technology is mainly divided into two categories: non-contact and contact. Non-contact technology, such as ultrasonic method, although complex in structure and high in cost, can provide high detection accuracy. Contact technology is widely used in medical equipment due to its simple structure, including air pressure method, mechanical vibration method, resistance method and capacitance method. Among them, the capacitance method liquid level detection technology uses the sample needle as a capacitance sensor to determine the liquid level position by detecting the change in capacitance value when the sample needle contacts the liquid. This method has the advantages of small size and simple implementation, but it is easily affected by the container material and solution properties.
[0003] Traditional liquid level detection methods are easily affected by environmental factors such as power supply fluctuations, temperature and humidity changes, and charge accumulation. In addition, in a multi-sample needle environment, when multiple sample needles work simultaneously, there will be interference with each other, affecting the detection accuracy. In the prior art, although attempts have been made to reduce interference by physically isolating sample needles or using shielding materials, the actual effect is limited. Therefore, the present invention aims to provide a high-precision, high-stability liquid level detection method to solve the problems of low liquid level detection accuracy, poor stability, and serious multi-needle interference in the prior art. Summary of the invention
[0004] In view of the problems existing in the prior art, the present invention provides a method for detecting liquid level with multiple sampling needles. An adaptive algorithm is used to dynamically adjust capacitance measurement parameters. A filtering algorithm is used to filter out abnormal capacitance data in the capacitance value data of the needle end of the sampling needle. By dynamically adjusting the weight matrix, noise in the liquid level detection process and interference caused by multiple liquid level detection can be effectively suppressed, which is conducive to adapting to environmental changes and the working conditions of multiple sampling needles to ensure the accuracy and stability of liquid level detection.
[0005] The technical solution adopted by the present invention is a multi-sample needle liquid level detection method, which comprises the following steps:
[0006] S1, energizing the liquid level detection circuit in the sample needle detection device and setting initial parameters for liquid level detection;
[0007] S2, perform liquid level detection on the solution to be detected, collect the capacitance value of the sample needle tip during liquid level detection in real time, and dynamically calculate the error value between the actual capacitance value and the predicted capacitance value of the sample needle tip through the objective function. The expression of the objective function is:
[0008]
[0009] In the formula, MES stands for minimum mean square error, n stands for the number of samples, and y i represents the true value of the i-th sample, x i Represents the value of the i-th sample predicted by the model;
[0010] S3, judging whether the error value in step S2 is less than a first threshold value, if the error value is greater than or equal to the first threshold value, re-collecting the capacitance value of the needle end of the sample adding needle during liquid level detection and performing iterative calculation; if the error value is less than the first threshold value, setting the current error value as the initial error value, and executing step S4;
[0011] S4, controlling the mechanical arm in the sample adding needle detection device to prepare for liquid level detection of the solution to be detected;
[0012] S5, performing a first liquid level detection on the solution to be detected, and recording the position of the sample adding needle when the sample adding needle contacts the liquid surface for the first time, specifically comprising the following sub-steps:
[0013] S51, controlling the sample adding needle to gradually approach the liquid surface of the solution to be detected;
[0014] S52, collecting the capacitance value of the needle end of the sample needle in real time, and calculating the current error value between the actual capacitance value of the needle end of the sample needle and the predicted capacitance value using the method in step S2;
[0015] S53, judging whether the difference between the current error value and the initial error value is greater than a second threshold value; if the difference between the current error value and the initial error value is less than or equal to the second threshold value, the sample adding needle has not touched the liquid surface of the solution, and returning to step S51; if the difference between the current error value and the initial error value is greater than the second threshold value, the sample adding needle has touched the liquid surface of the solution, and executing step S54;
[0016] S54, stop the liquid detection action, and record the first liquid detection position of the sample adding needle;
[0017] S6, repeat step S5 to perform a second liquid level detection on the solution to be detected, and record the second liquid detection position of the sample adding needle;
[0018] S7, calculate the difference between the first liquid detection position and the second liquid detection position, and determine whether the difference between the first liquid detection position and the second liquid detection position is within the third threshold range; if the difference between the first liquid detection position and the second liquid detection position exceeds the third threshold range, determine that the sample adding needle does not contact the liquid surface of the solution, repeat steps S5 and S6, and re-detect the liquid surface of the solution to be detected; if the difference between the first liquid detection position and the second liquid detection position is within the third threshold range, determine that the sample adding needle has contacted the liquid surface of the solution.
[0019] Preferably, in step S2, the first liquid level detection is performed on the solution to be detected, the capacitance value of the sample needle end during the first liquid level detection is collected in real time, and the error value between the actual capacitance value and the predicted capacitance value of the sample needle end is dynamically calculated through the objective function, which specifically includes the following steps:
[0020] S21, collecting in real time the capacitance value of the sample needle end during the first liquid level detection;
[0021] S22, according to the temperature change of the solution to be detected, the capacitance value of the tip of the sample needle collected in step S21 is compensated and calculated, and the expression is:
[0022] y i =k×(T i -T c )+v i
[0023] In the formula, y i represents the true value of the capacitance of the i-th sample, k represents the temperature compensation coefficient, T i represents the ambient temperature when the i-th sample is obtained, T c represents room temperature, v i represents the capacitance sampling value of the i-th sample;
[0024] S23, filtering out abnormal capacitance value data in the needle end capacitance value data by using a filtering algorithm;
[0025] S24, through the second-order low-pass filter, the high-frequency part of the needle end capacitance value data is attenuated to suppress noise and interference. The expression is:
[0026] y n =a0×x n +a1×x n-1 +a2×x n-2 -b1×y n-1 -b2×y n-2
[0027] In the formula, y n Indicates the filtered capacitance output value of the nth sample in this group of data, x n represents the nth capacitance sample value in the data set, a0, a1, a2, b1, b2 represent the second-order low-pass filter coefficients;
[0028] S25. Calculate the predicted capacitance value through the forward propagation formula, which is expressed as:
[0029] x i =W T ·z i +b
[0030] In the formula, x i Represents the predicted capacitance value, W T represents the transposed matrix of the weight vector, z i represents the feature vector of the i-th sample, and b represents the bias term;
[0031] S26. Calculate the error between the actual capacitance value and the predicted capacitance value using the loss calculation formula.
[0032] Preferably, in step S3, if the error value is greater than or equal to the first threshold, the capacitance value of the needle end of the sample adding needle during liquid level detection is recollected and iteratively calculated, and the specific steps are as follows:
[0033] S31, recollecting the capacitance value of the sample needle tip during liquid level detection;
[0034] S32, according to the temperature change of the solution to be detected, the capacitance value of the tip of the sample adding needle collected in step S31 is compensated and calculated, and the expression is:
[0035] y i =k×(T i -T c )+v i
[0036] In the formula, y i represents the true value of the capacitance of the i-th sample, k represents the temperature compensation coefficient, T i represents the ambient temperature when the i-th sample is obtained, T c represents room temperature, v i represents the capacitance sampling value of the i-th sample;
[0037] S33, the ten needle end capacitance value data c1-1, c1-2, ... c1-10 that have been collected are divided into a first group of data sets, the second group of data sets includes 9 needle end capacitance value data c1-1, c1-2, ... c1-9 and a newly collected needle end capacitance value data c2-1; the third group of data sets includes 8 needle end capacitance value data c1-1, c1-2, ... c1-8, one needle end capacitance value data c2-1 and a newly collected needle end capacitance value data c3-1, and the collected data are divided into data set groups according to this rule sequence;
[0038] S34, filtering out abnormal capacitance value data in the current group of needle end capacitance value data through a filtering algorithm;
[0039] S35, attenuate the high frequency part of the needle end capacitance value data through a second-order low-pass filter to suppress noise and interference, and the expression is:
[0040] y n =a0×xn +a1×x n-1 +a2×x n-2 -b1×y n-1 -b2×y n-2
[0041] In the formula, y n Indicates the filtered capacitance output value of the nth sample in this group of data, x n represents the nth capacitance sample value in the data set, a0, a1, a2, b1, b2 represent the second-order low-pass filter coefficients;
[0042] S36. Calculate the predicted capacitance value through the forward propagation formula, which is expressed as:
[0043] x i =W T ·z i +b
[0044] In the formula, x i Represents the predicted capacitance value, W T represents the transposed matrix of the weight vector, z i represents the feature vector of the i-th sample, and b represents the bias term;
[0045] S37. Calculate the error between the actual capacitance value and the predicted capacitance value using the loss calculation formula, which is expressed as:
[0046]
[0047] In the formula, MES stands for minimum mean square error, n stands for the number of samples, and y i represents the true value of the i-th sample, x i Represents the value of the i-th sample predicted by the model;
[0048] S38. Calculate the gradient of the weight vector and the bias term in step S36 through the back propagation formula as the gradient of the weight vector and the bias term for the next time. The expression is:
[0049]
[0050] In the formula, ▽ W represents the gradient of the weight vector, ▽ b represents the gradient of the bias term;
[0051] S39. Use the gradient descent method to calculate the weight value and bias term for the next calculation. The descent ratio is the preset learning rate. The update formula is:
[0052] W=W * -η·▽ W
[0053] b=b * -η·▽ b
[0054] Where W represents the updated weight vector, W * represents the original weight vector, b represents the updated bias term, b * represents the original bias term, η represents the learning rate of the weight parameter;
[0055] S310, repeating step S31 to step S310 until the error value between the actual capacitance value and the predicted capacitance value of the sample adding needle end is less than a first threshold, and setting the current error value as an initial error value.
[0056] Preferably, in step S24, a capacitance value less than 10 pF and a capacitance value greater than 20 pF is considered abnormal.
[0057] Preferably, in step S39, when the gradient of the weight vector is greater than the gradient of the previous weight vector, the weight parameter learning rate increase expression is:
[0058] η=η * +0.01;
[0059] When the gradient of the weight vector is less than the previous weight vector gradient, the expression for the weight parameter learning rate reduction is:
[0060] η=η * -0.01
[0061] Where η * Represents the initial weight parameter learning rate, η * =0.01.
[0062] Preferably, the first threshold value in step S3 is 0.2 pf.
[0063] Preferably, the second threshold value in step S53 is 0.5-2pf.
[0064] Preferably, the third threshold value in step S7 has a numerical range of 0.3 mm.
[0065] The characteristics and beneficial effects of the present invention are:
[0066] 1. The multi-sampling needle liquid level detection method provided by the present invention takes into account the influence of temperature on the capacitance value, adopts an adaptive algorithm to dynamically adjust the capacitance measurement parameters, and sets reasonable capacitance thresholds and filtering parameters to adapt to environmental changes and multi-needle working states, thereby ensuring the accuracy and stability of liquid level detection.
[0067] 2. The multi-sample needle liquid level detection method provided by the present invention adopts a filtering algorithm to filter out data with abnormal capacitance values in the capacitance value data of the sample needle tip, and can effectively suppress noise in the liquid level detection process and interference caused by multiple liquid level detections by dynamically adjusting the weight matrix.
[0068] 3. The multi-sample needle liquid level detection method provided by the present invention can ensure the accuracy of liquid level detection by performing liquid level detection multiple times, combining the sample needle position when the liquid detection is triggered, comparing the difference in the sample needle position during two liquid detections, and setting a reasonable deviation threshold. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 It is a flow chart of the method for detecting liquid level of multiple sample needles of the present invention;
[0070] Figure 2 is a flow chart of step S2 of the method for detecting liquid level of multiple sample needles of the present invention;
[0071] Figure 3 is a flow chart of step S3 of the method for detecting liquid level of multiple sample needles of the present invention;
[0072] Figure 4 is a flow chart of step S5 of the method for detecting liquid level of multiple sample needles of the present invention;
[0073] Figure 5 It is a schematic diagram of the liquid level detection circuit of the present invention. DETAILED DESCRIPTION
[0074] In order to fully describe the technical content, structural features, objectives and effects of the present invention, the following will be described in detail with reference to the accompanying drawings.
[0075] A method for detecting liquid level of multiple sample needles of the present invention, as Figure 1 As shown, it includes the following steps:
[0076] S1, energizing the liquid level detection circuit in the sample adding needle detection device and setting the initial parameters of the liquid level detection, specifically including the following steps:
[0077] S11 , starting the mechanical arm 1 in the sample adding needle detection device, and moving the sample adding needle 13 to above the container of the solution to be detected.
[0078] S12, controlling the robot arm 1 to drive the sample adding needle 13 to slowly move downward in the container of the solution to be detected, so that the needle end of the sample adding needle 13 gradually approaches the liquid surface of the solution to be detected.
[0079] S13, power on the liquid level detection circuit and set initial parameters for liquid level detection.
[0080] S14, start to detect the liquid level of the solution to be detected.
[0081] S2, perform liquid level detection on the solution to be detected, collect the capacitance value of the sample needle end during liquid level detection in real time, and dynamically calculate the error value between the actual capacitance value of the sample needle end 13 and the predicted capacitance value through the objective function, such as Figure 2 As shown, the specific steps include:
[0082] S21, collecting in real time the capacitance value at the needle end of the sample adding needle 13 during the first liquid level detection.
[0083] S22, according to the temperature change of the solution to be detected, the capacitance value at the tip of the sample adding needle 13 collected in step S21 is compensated and calculated, and the expression is:
[0084] y i =k×(T i -T c )+v i
[0085] In the formula, y i represents the true value of the capacitance of the i-th sample, k represents the temperature compensation coefficient, T i represents the ambient temperature when the i-th sample is obtained, T c represents room temperature, v i represents the capacitance sampling value of the i-th sample;
[0086] S23, filtering out abnormal capacitance data in the needle end capacitance data through a filtering algorithm.
[0087] S24, through the second-order low-pass filter, the high-frequency part of the needle end capacitance value data is attenuated, which can suppress noise and interference. The expression is:
[0088] y n =a0×x n +a1×x n-1 +a2×x n-2 -b1×y n-1 -b2×y n-2
[0089] In the formula, y n Indicates the filtered capacitance output value of the nth sample in this group of data, x n represents the nth capacitance sample value in this group of data, and a0, a1, a2, b1, and b2 represent second-order low-pass filter coefficients.
[0090] S25. Calculate the predicted capacitance value through the forward propagation formula, which is expressed as:
[0091] x i =W T ·z i +b
[0092] In the formula, x i Represents the predicted capacitance value, W T represents the transposed matrix of the weight vector, z i represents the feature vector of the i-th sample, and b represents the bias term.
[0093] S26. Calculate the error between the actual capacitance value and the predicted capacitance value using the loss calculation formula, which is expressed as:
[0094]
[0095] In the formula, MES stands for minimum mean square error, n stands for the number of samples, and y i represents the true value of the i-th sample, x i Represents the value of the i-th sample predicted by the model.
[0096] S3, determine whether the error value in step S2 is less than the first threshold value, if the error value is greater than or equal to the first threshold value, then repeat the iterative calculation, the specific steps are as follows, Figure 3 As shown; if the error value is less than the first threshold, the current error value is set as the initial error value, and step S4 is executed.
[0097] S31. Continue to collect the capacitance value at the end of the sampling needle during liquid level detection.
[0098] S32, according to the temperature change of the solution to be detected, the capacitance value of the tip of the sample adding needle collected in step S31 is compensated and calculated, and the expression is:
[0099] y i =k×(T i -T c )+v i
[0100] In the formula, y i represents the true value of the capacitance of the i-th sample, k represents the temperature compensation coefficient, T i represents the ambient temperature when the i-th sample is obtained, T c represents room temperature, v i Represents the capacitance sampling value of the i-th sample.
[0101] S33, the ten needle-end capacitance value data c1-1, c1-2, ... c1-10 that have been collected are divided into a first group of data sets, the second group of data sets includes 9 needle-end capacitance value data c1-1, c1-2, ... c1-9 and a newly collected needle-end capacitance value data c2-1; the third group of data sets includes 8 needle-end capacitance value data c1-1, c1-2, ... c1-8, one needle-end capacitance value data c2-1 and a newly collected needle-end capacitance value data c3-1, and the collected data are divided into data set groups in sequence according to this rule; that is, the ten needle-end capacitance value data that have been collected are divided into a first group of data sets, the second group of data sets includes the first 9 needle-end capacitance value data of the first group of data sets and a second group of newly collected needle-end capacitance value data; the third group of data sets includes the first 8 needle-end capacitance value data of the first group of data sets, a second group of newly collected needle-end capacitance value data and a third group of newly collected needle-end capacitance value data, and the collected data are divided into data set groups in sequence.
[0102] S34, filtering out abnormal capacitance value data in the current group of needle end capacitance value data through a filtering algorithm.
[0103] S35, attenuate the high frequency part of the needle end capacitance value data through a second-order low-pass filter to suppress noise and interference, and the expression is:
[0104] y n =a0×x n +a1×x n-1 +a2×x n-2 -b1×y n-1 -b2×y n-2
[0105] In the formula, y n Indicates the filtered capacitance output value of the nth sample in this group of data, x n represents the nth capacitance sample value in this group of data, and a0, a1, a2, b1, and b2 represent second-order low-pass filter coefficients.
[0106] S36. Calculate the predicted capacitance value through the forward propagation formula, which is expressed as:
[0107] x i =W T ·z i +b
[0108] In the formula, x i Represents the predicted capacitance value, W T represents the transposed matrix of the weight vector, z i represents the feature vector of the i-th sample, and b represents the bias term.
[0109] S37. Calculate the error between the actual capacitance value and the predicted capacitance value using the loss calculation formula, which is expressed as:
[0110]
[0111] In the formula, MES stands for minimum mean square error, n stands for the number of samples, and y i represents the true value of the i-th sample, x i Represents the value of the i-th sample predicted by the model.
[0112] S38. Calculate the gradient of the weight vector and the bias term in step S36 through the back propagation formula as the gradient of the weight vector and the bias term for the next time. The expression is:
[0113]
[0114] In the formula, ▽ W represents the gradient of the weight vector, ▽ b represents the gradient of the bias term.
[0115] S39. Use the gradient descent method to calculate the weight value and bias term for the next calculation. The descent ratio is the preset learning rate. The update formula is:
[0116] W=W * -η·▽ W
[0117] b=b * -η·▽ b
[0118] Where W represents the updated weight vector, W * represents the original weight vector, b represents the updated bias term, b * Represents the original bias term, and η represents the learning rate of the weight parameter.
[0119] S310, repeating step S31 to step S310 until the error value between the actual capacitance value and the predicted capacitance value at the end of the sample adding needle is less than a first threshold, and setting the current error value as an initial error value.
[0120] S4, controlling the mechanical arm 1 in the sample adding needle detection device to perform two liquid level detections on the solution to be detected.
[0121] S5, performing the first liquid level detection on the solution to be detected, and recording the position of the sample adding needle 13 when the sample adding needle 13 first contacts the liquid surface, such as Figure 4 As shown, the specific steps are as follows:
[0122] S51, controlling the sample adding needle 13 to gradually approach the liquid surface of the solution to be detected.
[0123] S52, collecting the capacitance value of the needle end of the sample adding needle 13 in real time, and executing step S2 to calculate the current error value between the actual capacitance value of the needle end of the sample adding needle 13 and the predicted capacitance value.
[0124] S53, determine whether the difference between the current error value and the initial error value is greater than the second threshold value. If the difference between the current error value and the initial error value is less than or equal to the second threshold value, the sample addition needle 13 has not contacted the solution surface, and return to step S51; if the difference between the current error value and the initial error value is greater than the second threshold value, the sample addition needle 13 has contacted the solution surface, and execute step S54.
[0125] S54, stop the liquid detection action and record the current position of the sample adding needle 13.
[0126] S6. Repeat step S5 to perform a second liquid level detection on the solution to be detected.
[0127] S7, calculate the difference between the first liquid detection position and the second liquid detection position, and determine whether the difference between the first liquid detection position and the second liquid detection position is within the third threshold range; if the difference between the first liquid detection position and the second liquid detection position exceeds the third threshold range, it is determined that the sample adding needle has not contacted the liquid surface of the solution, and then repeat steps S5 and S6 to re-detect the liquid surface of the solution to be detected; if the difference between the first liquid detection position and the second liquid detection position is within the third threshold range, it is determined that the sample adding needle has contacted the liquid surface of the solution.
[0128] Furthermore, in step S24, a capacitance value less than 10 pF and greater than 20 pF is an abnormal capacitance value.
[0129] Furthermore, in step S29, when the gradient of the weight vector is greater than the previous gradient of the weight vector, the weight parameter learning rate increase expression is:
[0130] η=η * +0.01.
[0131] When the gradient of the weight vector is less than the previous weight vector gradient, the expression for the weight parameter learning rate reduction is:
[0132] η=η * -0.01
[0133] Where η * Represents the initial weight parameter learning rate, η * =0.01.
[0134] Preferably, in step S3, the first threshold value is 0.2pf.
[0135] Preferably, the second threshold value in step S53 is 0.5-2pf.
[0136] Preferably, the third threshold value in step S7 has a numerical range of 0.3 mm.
[0137] like Figure 5 As shown, the multi-sample needle liquid level detection includes a first liquid level detection circuit and a second liquid level detection circuit, and the first liquid level detection circuit and the second liquid level detection circuit both include a mechanical arm 1, a liquid level detection circuit 11, a connector 12 and a sample needle 13. When detecting liquid, the mechanical arm 1 moves the sample needle 13 to the container position where the liquid level detection is required, and then lowers the sample needle 13 so that the sample needle 13 gradually approaches the liquid surface. When the sample needle 13 contacts the liquid surface, the signal detected by the liquid level detection circuit will exceed the set threshold. At this time, the liquid level detection circuit triggers an electrical signal to be output to the mechanical arm. After receiving the signal, the mechanical arm 1 stops lowering the sample needle 13. The liquid level detection circuit realizes the acquisition of the sample needle inductive capacitance signal, the acquisition signal processing and the judgment signal output. The liquid level detection circuit 11 is connected to the sample needle 13 through the connector 12, and the sample needle 13 is used as a detection electrode, and the other detection electrode is the ground. The liquid level detection circuit detects the capacitance value between the sample needle and the ground. When the sample needle touches the liquid surface, the capacitance between the sample needle and the ground produces a recognizable change, which is used to determine the liquid detection.
[0138] Working principle of the present invention:
[0139] First, you need to get an initial detection value to clarify the capacitance value of the current sampling needle end, which will be used for the calculation of the base value for comparison later. After the liquid detection module is powered on, the software will automatically start to obtain the capacitance value of the sampling needle end, obtain the first set of values within 100ms and calculate them as the initial value. In this way, the initial value is obtained in a short time after power-on without affecting actual use. After that, the detection data of the sampling needle end will be continuously collected, and the base value for comparison will be obtained through the algorithm. The real-time detected data will be compared with the base value to confirm whether it has contacted the liquid surface.
[0140] During the liquid detection process, the sample needle will continuously approach the liquid surface from a predetermined position. During this movement, the weight is automatically adjusted according to the real-time detection value of the sample needle end, and the basic value is dynamically calculated. Each time the real-time detected value is compared with the basic value, it is confirmed that the liquid surface is contacted if it exceeds the threshold. At this time, a detection signal is given and the movement of the sample needle is stopped. Even if the initial value is obtained when the sample needle contacts the liquid, a correct judgment can be made. The reason is that the basic value is adjusted dynamically in real time and can respond to changes quickly. If the sample needle initially contacts the liquid surface, the sample needle will return to the predetermined position before detection. After leaving the liquid surface, the basic value can be set within 10ms. Relative to the movement of the sample needle, this time can be ignored. After that, the detection action is performed, and the detection value of the contact liquid surface can obviously exceed the threshold, so that the liquid surface can be captured quickly and accurately.
[0141] Furthermore, considering that environmental factors and other interferences may affect the detection results. Therefore, when collecting data from the sample needle end in real time, the software will first perform a filter to filter out the detection values that are too large and do not meet the contact liquid surface. The filtered values will not participate in the calculation of the basic value. In this way, the stability of the basic value is enhanced. The dynamic calculation of the basic value and the real-time detection value makes the entire liquid detection have strong anti-interference performance. Because of the dynamic setting, the change in the needle end capacitance caused by the interference is also reflected in the basic value after setting. The detection value of the liquid surface captured by the sample needle is also changed by the interference. This variable can be basically offset in the comparison with the basic value, thereby eliminating the interference and accurately capturing the liquid surface. The main interferences eliminated in this stage are partial sudden interference and stable interference, such as interference caused by relatively stable interference sources such as temperature and humidity, power supply, and performance changes of components after power-on. After long-term operation, the accumulated charge at the sample needle end is also a stable interference. When multiple needles are used to detect liquid, the distance between the sample needles is too close and they interfere with each other. The interference value is determined by the charged strength of the sample needles. The interference is basically the same at the same distance. The fast response and automatic adjustment of the adaptive algorithm can effectively eliminate interference.
[0142] Finally, this method uses the comparison of the two liquid detection positions to form a verification of the liquid detection results and confirm that the liquid surface is truly detected. For the same liquid surface, the height position of each liquid detection should be stable. By comparing the positions of the two liquid detections, it can be clear that the liquid detection is correct within the preset smaller threshold range. When there is interference, the stable interference is eliminated by the aforementioned method. For unstable interference, the position of the sample needle that finally detects the liquid surface is significantly different. By calibrating the two positions, the accuracy of liquid detection can be further improved. In addition, when there are bubbles on the liquid surface to be detected, the height position comparison of the sample needle during the two detection triggers can effectively remove the bubble interference. Because the bubble itself is hollow, the detection value when it contacts the liquid surface is not consistent. However, the size of the hollow and the amount of total liquid are, to a certain extent, capacitive media. Different combinations may overlap with the detection value of the liquid surface, resulting in false detection. However, after the bubble wall contacts the sample needle for the first time, due to the tension of the liquid, the bubble wall will change, which will cause the position of the next detection to change from the previous one. It is this change that is used to eliminate the bubble interference. The method of comparing two detections can also effectively eliminate inaccurate liquid detection caused by liquid level fluctuations caused by mechanical vibrations, etc.
[0143] Example 1
[0144] Prepare a container filled with conductive liquid, the liquid level is within the range that the probe can touch, for example, the liquid level height is 75mm; use a robotic arm with two liquid probes to probe the liquid; after the system is powered on, the robotic arm is initialized to find the origin position. At the same time, the liquid probe circuit is initialized, and the relevant thresholds and other initial values of parameters are set. After that, the liquid probe module collects the needle end capacitance data and enters the iterative calculation process.
[0145] After the robot arm is initialized, move the robot arm so that the sample needle is above the liquid level to be detected, and the two needles are close to each other with a spacing of 13mm. Then move the first sample needle close to the liquid surface. When the needle end touches the liquid surface, the liquid detection circuit detects that the change in the needle end capacitance is greater than 0.5pf, and the sample needle stops moving. At this time, the recorded position is 74.948mm; the sample needle returns to the original position and continues to detect the liquid for the second time. It stops after contacting the liquid surface. At this time, the recorded position is 75.082mm; the error between the two liquid detections is 0.134mm, which is judged as the liquid surface is detected. The first needle completes the liquid detection and no longer moves.
[0146] The second needle was used in the same way to detect the liquid, and the error between the two detections was 0.037mm.
[0147] The present invention takes into account the influence of temperature on the capacitance value, adopts an adaptive algorithm to dynamically adjust the capacitance measurement parameters, and sets reasonable capacitance thresholds and filtering parameters to adapt to environmental changes and multi-needle working states, thereby ensuring the accuracy and stability of liquid level detection. At the same time, a filtering algorithm is adopted to filter out data with abnormal capacitance values in the capacitance value data of the needle end of the sampling needle, and by dynamically adjusting the weight matrix, noise in the liquid level detection process and interference caused by multiple liquid level detections can be effectively suppressed. In addition, by performing liquid level detection multiple times, combining the position of the sampling needle when the liquid detection is triggered, comparing the difference in the position of the sampling needle during the two liquid detections, and setting a reasonable deviation threshold, the accuracy of the liquid level detection can be ensured.
[0148] The embodiments described above are only descriptions of the preferred implementation modes of the present invention, and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.
Claims
1. A method for detecting liquid level with multiple sample needles, characterized in that: It includes the following steps: S1, energizing the liquid level detection circuit in the sample needle detection device and setting initial parameters for liquid level detection; S2, perform liquid level detection on the solution to be detected, collect the capacitance value of the sample needle tip during liquid level detection in real time, and dynamically calculate the error value between the actual capacitance value and the predicted capacitance value of the sample needle tip through the objective function. The expression of the objective function is: In the formula, MES stands for minimum mean square error, n stands for the number of samples, and y i represents the true value of the i-th sample, x i Represents the value of the i-th sample predicted by the model; S3, judging whether the error value in step S2 is less than a first threshold value, if the error value is greater than or equal to the first threshold value, re-collecting the capacitance value of the needle end of the sample adding needle during liquid level detection and performing iterative calculation; if the error value is less than the first threshold value, setting the current error value as the initial error value, and executing step S4; S4, controlling the mechanical arm in the sample adding needle detection device to prepare for liquid level detection of the solution to be detected; S5, performing a first liquid level detection on the solution to be detected, and recording the position of the sample adding needle when the sample adding needle contacts the liquid surface for the first time, specifically comprising the following sub-steps: S51, controlling the sample adding needle to gradually approach the liquid surface of the solution to be detected; S52, collecting the capacitance value of the needle end of the sample needle in real time, and calculating the current error value between the actual capacitance value of the needle end of the sample needle and the predicted capacitance value using the method in step S2; S53, judging whether the difference between the current error value and the initial error value is greater than a second threshold value; if the difference between the current error value and the initial error value is less than or equal to the second threshold value, the sample adding needle has not touched the liquid surface of the solution, and returning to step S51; if the difference between the current error value and the initial error value is greater than the second threshold value, the sample adding needle has touched the liquid surface of the solution, and executing step S54; S54, stop the liquid detection action, and record the first liquid detection position of the sample adding needle; S6, repeat step S5 to perform a second liquid level detection on the solution to be detected, and record the second liquid detection position of the sample adding needle; S7, calculating the difference between the first liquid detection position and the second liquid detection position, and determining whether the difference between the first liquid detection position and the second liquid detection position is within a third threshold range, if the difference between the first liquid detection position and the second liquid detection position exceeds the third threshold range, determining that the sample needle does not contact the liquid surface of the solution, repeating steps S5 and S6, and re-detecting the liquid surface of the solution to be detected; If the difference between the first liquid detection position and the second liquid detection position is within the third threshold range, it is determined that the sample addition needle has contacted the solution surface.
2. The method for detecting liquid level of multiple sample needles according to claim 1, characterized in that: In step S2, the first liquid level detection is performed on the solution to be detected, the capacitance value of the sample needle end during the first liquid level detection is collected in real time, and the error value between the actual capacitance value and the predicted capacitance value of the sample needle end is dynamically calculated through the objective function, which specifically includes the following steps: S21, collecting in real time the capacitance value of the needle end of the sampling needle during the first liquid level detection; S22, according to the temperature change of the solution to be detected, the capacitance value of the tip of the sample needle collected in step S21 is compensated and calculated, and the expression is: y i =k×(T i -T c )+v i In the formula, y i represents the true value of the capacitance of the i-th sample, k represents the temperature compensation coefficient, T i represents the ambient temperature when the i-th sample is obtained, T c represents room temperature, v i represents the capacitance sampling value of the i-th sample; S23, filtering out abnormal capacitance value data in the needle end capacitance value data by using a filtering algorithm; S24, through the second-order low-pass filter, the high-frequency part of the needle end capacitance value data is attenuated to suppress noise and interference. The expression is: and n =a0×x n +a1×x n-1 +a2×x n-2 -b1×y n-1 -b2×y n-2 In the formula, y n Indicates the filtered capacitance output value of the nth sample in this group of data, x n represents the nth capacitance sample value in the data set, a0, a1, a2, b1, b2 represent the second-order low-pass filter coefficients; S25. Calculate the predicted capacitance value through the forward propagation formula, which is expressed as: x i =W T ·z i +b In the formula, x i Represents the predicted capacitance value, W T represents the transposed matrix of the weight vector, z i represents the feature vector of the i-th sample, and b represents the bias term; S26. Calculate the error between the actual capacitance value and the predicted capacitance value using the loss calculation formula.
3. The method for detecting liquid level of multiple sample needles according to claim 1, characterized in that: In step S3, if the error value is greater than or equal to the first threshold, the capacitance value of the sample needle tip during liquid level detection is recollected and iteratively calculated, and the specific steps are as follows: S31, recollecting the capacitance value of the sample needle tip during liquid level detection; S32, according to the temperature change of the solution to be detected, the capacitance value of the tip of the sample adding needle collected in step S31 is compensated and calculated, and the expression is: y i =k×(T i -T c )+v i In the formula, y i represents the true value of the capacitance of the i-th sample, k represents the temperature compensation coefficient, T i represents the ambient temperature when the i-th sample is obtained, T c represents room temperature, v i represents the capacitance sampling value of the i-th sample; S33, the ten needle end capacitance value data c1-1, c1-2, ... c1-10 that have been collected are divided into a first group of data sets, the second group of data sets includes 9 needle end capacitance value data c1-1, c1-2, ... c1-9 and a newly collected needle end capacitance value data c2-1; the third group of data sets includes 8 needle end capacitance value data c1-1, c1-2, ... c1-8, one needle end capacitance value data c2-1 and a newly collected needle end capacitance value data c3-1, and the collected data are divided into data set groups according to this rule sequence; S34, filtering out abnormal capacitance value data in the current group of needle end capacitance value data through a filtering algorithm; S35, attenuate the high frequency part of the needle end capacitance value data through a second-order low-pass filter to suppress noise and interference, and the expression is: and n =a0×x n +a1×x n-1 +a2×x n-2 -b1×y n-1 -b2×y n-2 In the formula, y n Indicates the filtered capacitance output value of the nth sample in this group of data, x n represents the nth capacitance sample value in the data set, a0, a1, a2, b1, b2 represent the second-order low-pass filter coefficients; S36. Calculate the predicted capacitance value through the forward propagation formula, which is expressed as: x i =W T ·z i +b In the formula, x i Represents the predicted capacitance value, W T represents the transposed matrix of the weight vector, z i represents the feature vector of the i-th sample, and b represents the bias term; S37. Calculate the error between the actual capacitance value and the predicted capacitance value using the loss calculation formula, which is expressed as: In the formula, MES stands for minimum mean square error, n stands for the number of samples, and y i represents the true value of the i-th sample, x i Represents the value of the i-th sample predicted by the model; S38. Calculate the gradient of the weight vector and the bias term in step S36 through the back propagation formula as the gradient of the weight vector and the bias term for the next time. The expression is: In the formula, represents the gradient of the weight vector, represents the gradient of the bias term; S39. Use the gradient descent method to calculate the weight value and bias term for the next calculation. The descent ratio is the preset learning rate. The update formula is: Where W represents the updated weight vector, W * represents the original weight vector, b represents the updated bias term, b * represents the original bias term, η represents the learning rate of the weight parameter; S310, repeating step S31 to step S310 until the error value between the actual capacitance value and the predicted capacitance value of the sample adding needle end is less than a first threshold, and setting the current error value as an initial error value.
4. The method for detecting liquid level of multiple sample needles according to claim 2, characterized in that: In step S24 , a capacitance value less than 10 pF and greater than 20 pF is considered an abnormal capacitance value.
5. The method for detecting liquid level of multiple sample needles according to claim 3, characterized in that: In step S39, when the gradient of the weight vector is greater than the previous weight vector gradient, the weight parameter learning rate increase expression is: the=the * +0.01; When the gradient of the weight vector is less than the previous weight vector gradient, the expression for the weight parameter learning rate reduction is: the=the * -0.01 Where η * Represents the initial weight parameter learning rate, η * =0.
01.
6. The method for detecting liquid level of multiple sample needles according to claim 1, characterized in that: In step S3, the first threshold value is 0.2 pf.
7. The method for detecting liquid level of multiple sample needles according to claim 6, characterized in that: In step S53, the second threshold value is 0.5-2pf.
8. The method for detecting liquid level of multiple sample needles according to claim 7, characterized in that: In step S7, the third threshold value has a value range of 0.3 mm.
Citation Information
Cited By
Liquid level detection method and device, analyzer, storage medium and program product
CN120847429A