A method and system for compensating drift of water quality testing instruments

By constructing behavioral energy values ​​and drift coefficients based on sensor response curve sequences and combining them with a rule tree network, real-time drift compensation for water quality testing instruments was achieved, solving the measurement inaccuracy problem caused by sensor drift and improving the intelligence and accuracy of testing.

CN120632491BActive Publication Date: 2025-11-14江西鼎智检测有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511119731.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-11
Publication Date
2025-11-14
Estimated Expiration
2045-08-11

AI Technical Summary

Technical Problem

Existing water quality testing instruments suffer from decreased measurement accuracy and data reliability due to sensor drift during long-term operation. Current compensation methods rely on external real values, resulting in poor real-time performance and strong dependence.

Method used

Behavioral energy values ​​are constructed based on sensor response curve sequences. A function selection strategy network is constructed by introducing drift coefficients and rule trees to achieve flexible adaptation and compensation of the sensor response process.

Benefits of technology

It significantly improves the intelligent diagnostic capabilities and long-term operational accuracy of water quality testing instruments, and enhances their sensitivity to sensor drift and on-site adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120632491B_ABST
    Figure CN120632491B_ABST
Patent Text Reader

Abstract

This invention relates to the field of instrument drift technology, specifically to a drift compensation method and system for water quality testing instruments. It includes a detection response curve sequence acquisition module, a behavior energy value calculation module, a drift degree coefficient calculation module, and a drift compensation module. This invention introduces a function selection strategy network based on a rule tree into the compensation path, allowing the drift degree coefficient and sensor type label to jointly drive the selection process of the optimal compensation function. This eliminates the reliance on fixed rules or training models for drift compensation, enabling flexible adaptation based on real-time response states. This achieves stable output correction for various electrochemical water quality parameters under non-ideal operating conditions, significantly improving the intelligent diagnostic capabilities, long-term operational accuracy, and field adaptability of water quality testing instruments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of instrument drift technology, specifically to a method and system for compensating for drift in water quality testing instruments. Background Technology

[0002] Water quality testing instruments are widely used in various scenarios such as municipal water supply, sewage treatment, and environmental monitoring. They typically rely on electrochemical sensors (such as pH, conductivity, dissolved oxygen, ammonia nitrogen, and residual chlorine) to achieve real-time monitoring of key indicators in water bodies. However, during long-term operation, sensors are susceptible to factors such as electrode aging, membrane fouling, and temperature and humidity fluctuations, which can cause drift in the detection output, thereby affecting the accuracy and reliability of measurements.

[0003] In existing technologies, common drift compensation methods are mostly based on calculating the error between the measured value and the true value, and then deriving the compensation amount accordingly. These methods rely on the periodic acquisition of external true values, such as through manual sampling and testing, or backtesting of standard solutions, as a reference to calculate and correct instrument errors. However, this approach has limitations: true values ​​are usually not continuously available during routine online monitoring, resulting in a high dependence on external data and poor real-time performance. Summary of the Invention

[0004] This invention constructs a behavioral energy value to characterize the dynamic behavior of sensors based on the sensor response curve sequence collected by water quality testing instruments during actual operation. A drift coefficient is introduced as a normalized quantitative index of response capability degradation, enabling the sensor's speed, intensity, and stability characteristics during the response process to be uniformly encoded and compared across cycles. This significantly enhances the system's sensitivity and recognition ability to different types of sensor response drift (including point drift, gain drift, and hysteresis response). Simultaneously, a function selection strategy network based on a rule tree is introduced into the compensation path, allowing the drift coefficient and sensor type label to jointly drive the selection process of the optimal compensation function. This eliminates the reliance on fixed rules or training models for drift compensation, allowing for flexible adaptation based on real-time response status. This achieves stable output correction for various electrochemical water quality parameters under non-ideal operating conditions, significantly improving the intelligent diagnostic capability, long-term operational accuracy, and field adaptability of water quality testing instruments.

[0005] This invention provides a method for compensating for drift in a water quality testing instrument, comprising:

[0006] The detection response curve sequence of the corresponding sensor is collected in real time. The detection response curve sequence refers to the set of all sampling points from the initial output to the stable output of the water quality index value of the corresponding sensor after the water quality testing instrument comes into contact with the water body to be tested. The sampling point is in the form of (t, y), where t is the timestamp corresponding to the sampling point and y is the water quality index value corresponding to the sampling point.

[0007] The response T value is determined based on the detection response curve sequence of the corresponding sensor. The detection response curve sequence is divided based on the response T value pair to obtain the first segment of the detection response curve sequence. The behavioral energy value of the corresponding sensor is calculated based on the first segment of the detection response curve sequence.

[0008] The ratio of the behavior energy value of the corresponding sensor to the reference behavior energy value of the corresponding sensor is recorded as the drift coefficient;

[0009] The drift coefficient and sensor type label of the corresponding sensor are then fed into the trained compensation function selection strategy network for processing, and the corresponding compensation function number is output. The corresponding compensation function is then selected based on the compensation function number, and the drift coefficient is fed into the corresponding compensation function for calculation to obtain the compensation amount. Finally, the water quality index value of the last sampling point in the detection response curve sequence of the corresponding sensor is corrected by the compensation amount to complete the drift compensation operation.

[0010] As a preferred aspect, the response T value is determined based on the detection response curve sequence of the corresponding sensor, and the detection response curve sequence is divided based on the response T value pairs to obtain the first segment of the detection response curve sequence, which specifically includes the following:

[0011] The water quality index value corresponding to the first sampling point in the response curve sequence is used as the initial response value, and the stable response value is determined based on the end of the response curve sequence.

[0012] Multiply the difference between the stable response value and the initial response value by the change coefficient to obtain the change magnitude. Then sum the stable response value and the change magnitude to obtain the response T value.

[0013] Starting from the first sampling point in the detection response curve sequence, traverse all sampling points in the detection response curve sequence, find the first sampling point where the water quality index value is greater than the response T value, and mark it as the dividing point. Combine all sampling points from the first sampling point to the dividing point in the detection response curve sequence to form the first segment of the detection response curve sequence.

[0014] As a preferred aspect, the calculation of the corresponding sensor's behavioral energy value and the reference behavioral energy value based on the first segment of the detection response curve sequence specifically includes the following steps:

[0015] Map the time axis corresponding to all sampling points in the first segment of the detection response curve sequence to [0, 1], update the timestamps corresponding to all sampling points to obtain the response sequence; traverse the response sequence, calculate the slope between any two adjacent sampling points, and record it as the response change rate; then assign weights to all change time periods through a window function, and regard the time periods corresponding to two adjacent sampling points as a time period; finally, perform a weighted summation operation on all response change rates and the weights assigned by the window function to obtain the behavior energy value of the corresponding sensor;

[0016] The calculation method for the reference behavioral energy value is the same as that for the corresponding sensor behavioral energy value. The difference is that the first part of the detection response curve sequence when calculating the reference behavioral energy value is obtained based on the corresponding sensor being immersed in a standard water sample with known parameter values.

[0017] As a preferred approach, the compensation function is constructed as follows:

[0018] Obtain several drift training samples, which include drift feature vectors. The drift feature vectors include the drift degree coefficient of the corresponding sensor and the sensor type label of the corresponding sensor. Perform cluster analysis on all drift feature vectors. Each cluster is recorded as a drift mode, and each drift mode corresponds to several drift training samples. Set a corresponding compensation function number for each drift mode.

[0019] For each drift pattern, perform the following operation: fit the mapping relationship between the compensation amount and the drift degree coefficient for all drift training samples corresponding to the drift pattern.

[0020] As a preferred approach, training the policy network for the compensation function selection includes the following steps:

[0021] Several drift training samples are obtained and labeled by the compensation function number. All labeled drift training samples are combined into a drift training set. The compensation function selection policy network is trained using the drift training set, with the labeled compensation function number as the training target.

[0022] As a preferred aspect, the compensation function includes linear, piecewise linear, or exponential functions.

[0023] The present invention also provides a drift compensation system for a water quality testing instrument, comprising:

[0024] The detection response curve sequence acquisition module is used to acquire the detection response curve sequence of the corresponding sensor in real time. The detection response curve sequence refers to the set of all sampling points from the initial output to the stable output of the water quality index value detected by the corresponding sensor after the water quality testing instrument comes into contact with the water body to be tested. The sampling point is in the form of (t, y), where t is the timestamp corresponding to the sampling point and y is the water quality index value corresponding to the sampling point.

[0025] The behavior energy value calculation module is used to determine the response T value based on the detection response curve sequence of the corresponding sensor, divide the detection response curve sequence based on the response T value pair to obtain the first segment of the detection response curve sequence, and calculate the behavior energy value of the corresponding sensor based on the first segment of the detection response curve sequence.

[0026] The drift coefficient calculation module is used to record the ratio of the behavior energy value of the corresponding sensor to the reference behavior energy value of the corresponding sensor as the drift coefficient.

[0027] The drift compensation module is used to input the drift degree coefficient and sensor type label of the corresponding sensor into the trained compensation function selection strategy network for processing, output the corresponding compensation function number, select the corresponding compensation function based on the compensation function number, input the drift degree coefficient into the corresponding compensation function for calculation to obtain the compensation amount, and finally, correct the water quality index value of the last sampling point in the detection response curve sequence of the corresponding sensor through the compensation amount, thus completing the drift compensation operation.

[0028] The present invention has the following advantages:

[0029] This invention constructs a behavioral energy value to characterize the dynamic behavior of sensors based on the sensor response curve sequence collected by water quality testing instruments during actual operation. A drift coefficient is introduced as a normalized quantitative index of response capability degradation, enabling the sensor's speed, intensity, and stability characteristics during the response process to be uniformly encoded and compared across cycles. This significantly enhances the system's sensitivity and recognition ability to different types of sensor response drift (including point drift, gain drift, and hysteresis response). Simultaneously, a function selection strategy network based on a rule tree is introduced into the compensation path, allowing the drift coefficient and sensor type label to jointly drive the selection process of the optimal compensation function. This eliminates the reliance on fixed rules or training models for drift compensation, allowing for flexible adaptation based on real-time response status. This achieves stable output correction for various electrochemical water quality parameters under non-ideal operating conditions, significantly improving the intelligent diagnostic capability, long-term operational accuracy, and field adaptability of water quality testing instruments. Attached Figure Description

[0030] Figure 1 This is a schematic diagram of the drift compensation system for the water quality testing instrument used in an embodiment of the present invention. Detailed Implementation

[0031] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this invention.

[0032] Example 1: A method for compensating for drift in a water quality testing instrument, comprising:

[0033] During the use of water quality testing instruments, the detection response curve sequence of the corresponding sensors is collected in real time. It should be noted that the water quality testing instruments generally include various electrochemical water quality sensors such as pH, dissolved oxygen (DO), conductivity, ammonia nitrogen, and residual chlorine. Water quality detection functions can be realized through these electrochemical water quality sensors. The detection response curve sequence refers to the set of all sampling points from the initial output to the stable output of the water quality index value detected by the corresponding sensor after the water quality testing instrument comes into contact with the water body to be tested. The sampling time corresponding to the detection response curve sequence is generally one minute, and the sampling frequency is generally 1 second. The form of the sampling point is (t, y), where t is the timestamp corresponding to the sampling point, and y is the water quality index value corresponding to the sampling point (such as pH value, dissolved oxygen value, and ammonia nitrogen value).

[0034] The response T value is determined based on the detection response curve sequence of the corresponding sensor. The detection response curve sequence is divided based on the response T value to obtain the first segment of the detection response curve sequence. The behavioral energy value of the corresponding sensor is calculated based on the first segment of the detection response curve sequence. Here, the response T value is used to divide the detection response curve sequence. The first segment of the divided detection response curve sequence can characterize the main change stage of the corresponding sensor. It should be noted that during the operation of the water quality testing instrument, after the sensor comes into contact with a new water sample, the water quality index value output by the sensor shows a non-instantaneous change response process over time. This is because there are a series of physical-chemical mechanisms such as electrode polarization, charge migration, and diffusion stabilization inside the sensor. This application utilizes the dynamic characteristics contained in the main change stage to construct the basis for judging the sensor drift state. The behavioral energy value can characterize the behavioral characteristics of the water quality index value in the response process, such as speed, intensity, and persistence.

[0035] The ratio of the corresponding sensor's behavioral energy value to its reference behavioral energy value is denoted as the drift coefficient. The reference behavioral energy value is determined based on the sensor's response state during measurement of a calibrated water body at the time of manufacture, reflecting the sensor's standard response characteristics. Calculating the ratio of the sensor's behavioral energy value to its reference value allows analysis of the difference between the current response characteristics and the standard response characteristics when measuring the target water body, thus reflecting the sensor's drift. The drift coefficient is constructed using the ratio of the current behavioral energy value to the reference behavioral energy value. This method outputs the influence of amplitude and response time differences, making the drift coefficient a dimensionless, cross-period, and cross-device comparable performance retention indicator.

[0036] The drift coefficient and sensor type label of the corresponding sensor are then fed into the trained compensation function selection strategy network for processing, outputting the corresponding compensation function number. Based on this number, the corresponding compensation function is selected, and the drift coefficient is fed into the corresponding compensation function for calculation to obtain the compensation amount. Finally, the water quality index value of the last sampling point in the detection response curve sequence of the corresponding sensor is corrected using the compensation amount, completing the drift compensation operation. The compensation function here includes linear, piecewise linear, or exponential functions, etc., and is fitted based on the mapping relationship between the compensation amount and the drift coefficient. The compensation function selection strategy network is built based on a decision tree model, which is essentially a rule tree. It can determine the drift mode of the corresponding sensor, such as zero-point drift, gain drift, and hysteresis response, based on the drift coefficient and the sensor type label. The compensation function selection strategy network is based on a multilayer perceptron.

[0037] This invention constructs a behavioral energy value to characterize the dynamic behavior of sensors based on the sensor response curve sequence collected by water quality testing instruments during actual operation. A drift coefficient is introduced as a normalized quantitative index of response capability degradation, enabling the sensor's speed, intensity, and stability characteristics during the response process to be uniformly encoded and compared across cycles. This significantly enhances the system's sensitivity and recognition ability to different types of sensor response drift (including point drift, gain drift, and hysteresis response). Simultaneously, a function selection strategy network based on a rule tree is introduced into the compensation path, allowing the drift coefficient and sensor type label to jointly drive the selection process of the optimal compensation function. This eliminates the reliance on fixed rules or training models for drift compensation, allowing for flexible adaptation based on real-time response status. This achieves stable output correction for various electrochemical water quality parameters under non-ideal operating conditions, significantly improving the intelligent diagnostic capability, long-term operational accuracy, and field adaptability of water quality testing instruments.

[0038] Compared to methods that directly compensate based on the difference between measured and true values, behavioral energy offers several significant advantages: First, measurement error only reflects the final result and cannot reveal the dynamic degradation of the sensor response process, while behavioral energy originates from the speed, intensity, and persistence characteristics of the entire response process, reflecting the degradation mechanism itself. Second, measurement error relies on external true value references, making it difficult to continuously obtain in actual operation, while behavioral energy can be autonomously evaluated by comparing with a reference response curve, making it suitable for online deployment. Third, behavioral energy is more sensitive to slight decreases in response capability, resulting in more accurate compensation amounts. Fourth, behavioral energy is a continuous dimensionless index, which can be used as a unified input to drive compensation function modeling and strategy matching, applicable to multiple types of sensors and drift modes. Finally, compared to the difficulty in distinguishing drift types by error values, behavioral energy, combined with dynamic characteristics such as response rate, can construct a complete drift state vector, helping to accurately identify drift modes and match precise compensation paths.

[0039] The response T value is determined based on the detection response curve sequence of the corresponding sensor. The detection response curve sequence is then divided based on the response T value pairs to obtain the first segment of the detection response curve sequence, which specifically includes the following:

[0040] The water quality index value corresponding to the first sampling point in the response curve sequence is taken as the initial response value, and the stable response value is determined based on the end of the response curve sequence. The stable response value here generally refers to the average value of the last 5 water quality index values ​​in the last response curve sequence.

[0041] Multiply the difference between the stable response value and the initial response value by the change coefficient to obtain the change amplitude. The confidence coefficient here is generally 90%, which represents the proportion of the theoretical response process time of the sensor. The change amplitude represents the total change amplitude experienced by the sensor in this response. Then, the stable response value and the change amplitude are summed to obtain the response T value.

[0042] Starting from the first sampling point in the detection response curve sequence, traverse all sampling points in the detection response curve sequence, find the first sampling point where the water quality index value is greater than the response T value, and mark it as the dividing point. Combine all sampling points from the first sampling point to the dividing point in the detection response curve sequence to form the first segment of the detection response curve sequence.

[0043] The calculation of the corresponding sensor's behavioral energy value and the reference behavioral energy value based on the first segment of the detection response curve sequence includes the following steps:

[0044] Map the time axis corresponding to all sampling points in the first segment of the detection response curve sequence to [0, 1], update the timestamps corresponding to all sampling points to obtain the response sequence, so that the time axis of the calculated behavior energy value is unified. The specific mapping method is as follows: divide the difference between the timestamp corresponding to the sampling point and the timestamp corresponding to the first sampling point in the detection response curve sequence by the total length of the time axis corresponding to the first segment of the detection response curve sequence; traverse the response sequence, calculate the slope between any two adjacent sampling points, and record it as the response change rate; then assign weights to all change time periods through a window function. Here, the window function can be a Hamming window or an exponential weight window. The time periods corresponding to two adjacent sampling points are regarded as a time period. Finally, perform a weighted summation operation on all response change rates and the weights assigned by the window function to obtain the behavior energy value of the corresponding sensor.

[0045] The calculation method for the reference behavioral energy value is the same as that for the corresponding sensor behavioral energy value. The difference is that the first part of the detection response curve sequence when calculating the reference behavioral energy value is obtained based on the corresponding sensor being immersed in a standard water sample with known parameter values.

[0046] The compensation function is constructed as follows:

[0047] Several drift training samples are obtained, including drift feature vectors. Each drift feature vector includes the drift degree coefficient of the corresponding sensor and the sensor type label of the corresponding sensor. These drift feature vectors are obtained and constructed by the operator based on the actual water quality testing process. Cluster analysis is performed on all drift feature vectors. Each cluster is denoted as a drift pattern, and each drift pattern corresponds to several drift training samples. The clustering algorithm is K-means algorithm, and a corresponding compensation function number is set for each drift pattern.

[0048] For each drift pattern, perform the following operations: fit the mapping relationship between the compensation amount and the drift degree coefficient for all drift training samples corresponding to the drift pattern. The fitting method includes linear, piecewise linear or exponential functions. Select the fitting method with the highest accuracy as the compensation function.

[0049] Training the policy network for the compensation function selection process includes the following steps:

[0050] Obtain several drift training samples and label them with compensation function numbers, which correspond to the drift patterns of the drift training samples. Combine all labeled drift training samples into a drift training set and train the compensation function selection policy network using the drift training set. Use the labeled compensation function numbers as the training target and determine whether the training conditions are met. The training conditions are generally that the accuracy of the compensation function selection policy network meets expectations. If the training conditions are met, output the trained compensation function selection policy network; otherwise, continue training the compensation function selection policy network using the drift training set.

[0051] Example 2, a drift compensation system for a water quality testing instrument, see [link / reference] Figure 1 ,include:

[0052] The detection response curve sequence acquisition module is used to acquire the detection response curve sequence of the corresponding sensor in real time during the use of water quality testing instruments. It should be noted that the water quality testing instruments here generally include various electrochemical water quality sensors such as pH, dissolved oxygen (DO), conductivity, ammonia nitrogen, and residual chlorine. Water quality detection functions can be realized through these electrochemical water quality sensors. The detection response curve sequence here refers to the collection of all sampling points from the initial output to the stable output of the water quality index value of the corresponding sensor after the water quality testing instrument comes into contact with the water body to be tested. The sampling time corresponding to the detection response curve sequence is generally one minute, and the sampling frequency is generally 1 second. The form of the sampling point is (t, y), where t is the timestamp corresponding to the sampling point, and y is the water quality index value (such as pH value, dissolved oxygen value, and ammonia nitrogen value) corresponding to the sampling point.

[0053] The behavioral energy value calculation module is used to determine the response T value based on the detection response curve sequence of the corresponding sensor, divide the detection response curve sequence based on the response T value to obtain the first segment of the detection response curve sequence, and calculate the behavioral energy value of the corresponding sensor based on the first segment of the detection response curve sequence. Here, the response T value is used to divide the detection response curve sequence. The first segment of the divided detection response curve sequence can characterize the main change stage of the corresponding sensor. It should be noted that during the operation of the water quality testing instrument, after the sensor comes into contact with a new water sample, the water quality index value output by the sensor shows a non-instantaneous change response process over time. This is because there are a series of physical-chemical mechanisms such as electrode polarization, charge migration, and diffusion stabilization inside the sensor. This application utilizes the dynamic characteristics contained in the main change stage to construct the basis for judging the sensor drift state. The behavioral energy value can characterize the behavioral characteristics of the water quality index value in the response process, such as speed, intensity, and persistence.

[0054] The drift coefficient calculation module is used to record the ratio of the corresponding sensor's behavioral energy value to its reference behavioral energy value as the drift coefficient. The reference behavioral energy value is determined based on the sensor's response state during measurement in a calibrated water body at the time of manufacture, reflecting the sensor's standard response characteristics. Calculating the ratio of the sensor's behavioral energy value to its reference value allows analysis of the difference between the current response characteristics and the standard response characteristics when measuring the target water body, thus reflecting the sensor's drift. The drift coefficient is constructed using the ratio of the current behavioral energy value to the reference behavioral energy value. This method outputs the impact of amplitude and response time differences, making the drift coefficient a dimensionless, cross-cycle, and cross-device comparable performance retention indicator.

[0055] The drift compensation module is used to input the drift degree coefficient and sensor type label of the corresponding sensor into a trained compensation function selection strategy network for processing, outputting the corresponding compensation function number, and then selecting the corresponding compensation function based on the compensation function number. The drift degree coefficient is then input into the corresponding compensation function for calculation to obtain the compensation amount. Finally, the water quality index value of the last sampling point in the detection response curve sequence of the corresponding sensor is corrected by the compensation amount, completing the drift compensation operation. The compensation function here includes linear, piecewise linear, or exponential functions, etc., and is obtained by fitting the mapping relationship between the compensation amount and the drift degree coefficient. The compensation function selection strategy network is built based on a decision tree model, which is essentially a rule tree. It can determine the drift mode of the corresponding sensor, such as zero-point drift, gain drift, and hysteresis response, based on the drift degree coefficient and the sensor type label of the corresponding sensor. The compensation function selection strategy network is based on a multilayer perceptron.

[0056] It should be understood that those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims. Parts not described in detail in this specification are prior art known to those skilled in the art.

Claims

1. A method for compensating for drift in a water quality testing instrument, characterized in that, include: The detection response curve sequence of the corresponding sensor is collected in real time. The detection response curve sequence refers to the set of all sampling points from the initial output to the stable output of the water quality index value of the corresponding sensor after the water quality testing instrument comes into contact with the water body to be tested. The sampling point is in the form of (t, y), where t is the timestamp corresponding to the sampling point and y is the water quality index value corresponding to the sampling point. The response T value is determined based on the detection response curve sequence of the corresponding sensor. The detection response curve sequence is divided based on the response T value to obtain the first segment of the detection response curve sequence. The behavioral energy value of the corresponding sensor is calculated based on the first segment of the detection response curve sequence. The ratio of the behavior energy value of the corresponding sensor to the reference behavior energy value of the corresponding sensor is recorded as the drift coefficient; The drift coefficient and sensor type label of the corresponding sensor are then fed into the trained compensation function selection strategy network for processing, and the corresponding compensation function number is output. The corresponding compensation function is then selected based on the compensation function number, and the drift coefficient is fed into the corresponding compensation function for calculation to obtain the compensation amount. Finally, the water quality index value of the last sampling point in the detection response curve sequence of the corresponding sensor is corrected by the compensation amount to complete the drift compensation operation. The response T value is determined based on the detection response curve sequence of the corresponding sensor. The detection response curve sequence is then divided based on the response T value to obtain the first segment of the detection response curve sequence, which specifically includes: The water quality index value corresponding to the first sampling point in the response curve sequence is used as the initial response value, and the stable response value is determined based on the end of the response curve sequence. Multiply the difference between the stable response value and the initial response value by the change coefficient to obtain the change magnitude. Then sum the stable response value and the change magnitude to obtain the response T value. Starting from the first sampling point in the detection response curve sequence, traverse all sampling points in the detection response curve sequence, find the first sampling point where the water quality index value is greater than the response T value, and mark it as the dividing point. Combine all sampling points from the first sampling point to the dividing point in the detection response curve sequence to form the first segment of the detection response curve sequence. The behavioral energy value of the corresponding sensor is calculated based on the first segment of the detection response curve sequence, specifically including: Map the time axis corresponding to all sampling points in the first segment of the detection response curve sequence to [0, 1], update the timestamps corresponding to all sampling points to obtain the response sequence; traverse the response sequence, calculate the slope between any two adjacent sampling points, and record it as the response change rate; then assign weights to all change time periods through a window function, considering the time periods between two adjacent sampling points as one time period; finally, perform a weighted summation operation on all response change rates and the weights assigned by the window function to obtain the behavioral energy value of the corresponding sensor.

2. The method for compensating for drift in a water quality testing instrument according to claim 1, characterized in that, The compensation function is constructed as follows: Obtain several drift training samples, which include drift feature vectors. The drift feature vectors include the drift degree coefficient of the corresponding sensor and the sensor type label of the corresponding sensor. Perform cluster analysis on all drift feature vectors. Each cluster is recorded as a drift mode, and each drift mode corresponds to several drift training samples. Set a corresponding compensation function number for each drift mode. For each drift pattern, perform the following operation: fit the mapping relationship between the compensation amount and the drift degree coefficient for all drift training samples corresponding to the drift pattern.

3. The method for compensating for drift in a water quality testing instrument according to claim 2, characterized in that, Training the policy network for the compensation function selection process includes the following steps: Obtain several drift training samples and label them with compensation function numbers. Combine all labeled drift training samples into a drift training set. Train the compensation function selection policy network using the drift training set, with the labeled compensation function numbers as the training target. Determine if the training conditions are met. The training condition is that the accuracy of the compensation function selection policy network meets expectations. If the training conditions are met, output the trained compensation function selection policy network. Otherwise, continue training the compensation function selection policy network using the drift training set.

4. The method for compensating for drift in a water quality testing instrument according to claim 3, characterized in that, Compensation functions can take the form of linear, piecewise linear, or exponential functions.

5. A drift compensation system for a water quality testing instrument, characterized in that, The system employs a water quality testing instrument drift compensation method according to any one of claims 1-4, comprising: The detection response curve sequence acquisition module is used to acquire the detection response curve sequence of the corresponding sensor in real time. The detection response curve sequence refers to the set of all sampling points from the initial output to the stable output of the water quality index value detected by the corresponding sensor after the water quality testing instrument comes into contact with the water body to be tested. The sampling point is in the form of (t, y), where t is the timestamp corresponding to the sampling point and y is the water quality index value corresponding to the sampling point. The behavior energy value calculation module is used to determine the response T value based on the detection response curve sequence of the corresponding sensor, divide the detection response curve sequence based on the response T value to obtain the first segment of the detection response curve sequence, and calculate the behavior energy value of the corresponding sensor based on the first segment of the detection response curve sequence. The drift coefficient calculation module is used to record the ratio of the behavior energy value of the corresponding sensor to the reference behavior energy value of the corresponding sensor as the drift coefficient. The drift compensation module is used to input the drift degree coefficient and sensor type label of the corresponding sensor into the trained compensation function selection strategy network for processing, output the corresponding compensation function number, select the corresponding compensation function based on the compensation function number, input the drift degree coefficient into the corresponding compensation function for calculation to obtain the compensation amount, and finally, correct the water quality index value of the last sampling point in the detection response curve sequence of the corresponding sensor through the compensation amount, thus completing the drift compensation operation.

Citation Information

Patent Citations

  • Long-term drift error compensation method for gravity sensor

    CN109613618A

  • Error correction system and method for marine environment observation data

    CN120314529A