Method and device for compensating measurement error of ammonia nitrogen in water and electronic equipment

By adjusting the error compensation model and combining environmental and instrument parameters, adaptive compensation and dynamic calibration of ammonia nitrogen determination in water are achieved, which solves the problem of measurement result deviation in traditional methods and improves measurement accuracy and efficiency.

CN120703014AInactive Publication Date: 2025-09-26HANGZHOU PEOPLE HEALTH DETECTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510979660.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-09-26
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The traditional method of determining ammonia nitrogen in water is affected by environmental factors and instrument aging, resulting in deviations in measurement results and a lack of real-time dynamic compensation, which affects the accuracy of the measurement results.

Method used

By obtaining the absorbance value of the standard ammonia nitrogen solution, adjusting the error compensation model, combining the environmental parameters and instrument state parameters, and using the target error compensation model for correction, the target ammonia nitrogen concentration is obtained, realizing adaptive compensation and dynamic calibration.

Benefits of technology

It effectively overcomes the influence of environmental and instrument status changes on the measurement results, improves the accuracy and reliability of ammonia nitrogen concentration determination, reduces manual operation and calibration workload, and improves measurement efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120703014A_ABST
    Figure CN120703014A_ABST
Patent Text Reader

Abstract

The invention discloses a water ammonia nitrogen measurement error compensation method and device and electronic equipment, and relates to the field of environment monitoring. The method comprises the following steps: acquiring a first absorbance value of a standard ammonia nitrogen solution through a photoelectric colorimeter, and comparing the first absorbance value with a preset standard absorbance value to obtain a comparison result; adjusting parameters of a preset error compensation model based on the comparison result to obtain a target error compensation model; a solution to be measured is obtained, a second absorbance value of the solution to be measured under a preset wavelength is measured, and the preset wavelength is the maximum absorption wavelength for ammonia nitrogen measurement; environment parameters and instrument state parameters are obtained, the environment parameters comprise the target temperature and the target pH value, and the instrument state parameters comprise the sensor response time of the photoelectric colorimeter; and inputting the environmental parameters, the instrument state parameters and the second absorbance value into a target error compensation model to obtain the target ammonia nitrogen concentration. By implementing the technical scheme provided by the invention, the accuracy of ammonia nitrogen concentration measurement is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method, device and electronic equipment for compensating for errors in determining ammonia nitrogen in water. Background Art

[0002] With the rapid development of global industrialization and urbanization, water pollution is becoming increasingly serious, especially ammonia nitrogen pollution, which has a significant negative impact on the aquatic environment. As a common water pollutant, the accurate measurement of ammonia nitrogen concentration is crucial for water quality monitoring and environmental protection. As a result, the demand for monitoring ammonia nitrogen in water has increased dramatically, driving the development of related measurement technologies.

[0003] Currently, traditional methods for measuring ammonia nitrogen in water primarily rely on techniques such as photoelectric colorimetry. Although these methods are widely used, they still have some shortcomings. For example, environmental factors (such as changes in temperature and pH) and instrument aging or calibration issues often lead to deviations in measurement results. Furthermore, these methods often neglect real-time dynamic compensation, which affects the accuracy of measurement results under changing environmental conditions.

[0004] Therefore, there is an urgent need for a method, device and electronic equipment for compensating errors in determining ammonia nitrogen in water. Summary of the Invention

[0005] The present application provides a method, device and electronic equipment for compensating for errors in determining ammonia nitrogen in water, thereby improving the accuracy of ammonia nitrogen concentration determination.

[0006] In a first aspect of the present application, a method for compensating for an error in determining ammonia nitrogen in water is provided, the method comprising: obtaining a first absorbance value of a standard ammonia nitrogen solution through a photoelectric colorimeter, and comparing the first absorbance value with a preset standard absorbance value to obtain a comparison result; adjusting parameters of a preset error compensation model based on the comparison result to obtain a target error compensation model; obtaining a solution to be tested, and measuring a second absorbance value of the solution to be tested at a preset wavelength, wherein the preset wavelength is the maximum absorption wavelength for ammonia nitrogen determination; obtaining environmental parameters and instrument status parameters, wherein the environmental parameters include a target temperature and a target pH value, and the instrument status parameters include a sensor response time of the photoelectric colorimeter; and inputting the environmental parameters, the instrument status parameters, and the second absorbance value into the target error compensation model to obtain a target ammonia nitrogen concentration.

[0007] By adopting the above technical solution, the first absorbance value of the standard ammonia nitrogen solution is obtained and compared with the preset standard absorbance value. Based on the comparison result, the preset error compensation model is adaptively adjusted to obtain the target error compensation model. Then, the second absorbance value of the solution to be tested is obtained, and the environmental parameters (such as temperature and pH value) and instrument state parameters (such as sensor response time) are obtained at the same time. These parameters are input into the target error compensation model, and finally the corrected target ammonia nitrogen concentration is obtained. Through this method, the influence of changes in environmental conditions and fluctuations in instrument status on the ammonia nitrogen determination results can be effectively overcome, adaptive compensation and dynamic calibration of the measurement process can be achieved, and the accuracy and reliability of ammonia nitrogen concentration determination can be improved.

[0008] Optionally, the calculation formula of the target error compensation model is: Wherein, C is the target ammonia nitrogen concentration, A1 is the second absorbance value, E is the ideal absorbance coefficient without environmental influence, T is the target temperature, T0 is the standard temperature, p is the target pH value, p0 is the standard pH value, Q is the sensor response time of the photoelectric colorimeter, Q0 is the standard sensor response time; k, m, and α are compensation factors.

[0009] By adopting the above technical solution and introducing compensation factors and mathematical functions, a quantitative description and correction of measurement errors is achieved. Temperature and pH are introduced as exponential functions, reflecting the nonlinear effect of environmental conditions on absorbance; sensor response time is introduced as a logarithmic function, reflecting the degree of influence of instrument status on absorbance. By properly setting the compensation factor, the error compensation model can be optimized and adapted to different measurement environments and instrument conditions, thereby improving the accuracy and stability of ammonia nitrogen concentration determination results.

[0010] Optionally, the first absorbance value of the standard ammonia nitrogen solution is obtained by a photoelectric colorimeter, and the first absorbance value is compared with a preset standard absorbance value to obtain a comparison result, specifically including: obtaining a plurality of standard ammonia nitrogen solutions with different concentrations, and measuring the absorbance value of each of the standard ammonia nitrogen solutions at the preset wavelength to obtain a first absorbance value set; calculating the linear regression equation of each absorbance value in the first absorbance value set and the corresponding concentration to obtain a regression coefficient and a regression intercept; comparing the regression coefficient and the regression intercept with a preset standard value, and when the deviation exceeds a preset threshold, determining that the comparison result is inaccurate; otherwise, determining that the comparison result is qualified.

[0011] By adopting the above technical solution, the absorbance values ​​of a plurality of standard solutions of different concentrations at a preset wavelength are measured to obtain a first absorbance value set, and the linear regression equation thereof with the corresponding concentration is calculated to obtain the regression coefficient and the regression intercept. Then, the regression coefficient and the regression intercept are compared with the preset standard value, and the comparison result is judged as inaccurate or qualified according to whether the deviation exceeds the preset threshold. This method comprehensively evaluates the measurement performance and calibration status of the photoelectric colorimeter by introducing multiple standard samples and linear regression analysis, and promptly discovers and diagnoses the inaccuracy problem of the instrument. At the same time, by setting a reasonable preset threshold, the trigger conditions and frequency of the instrument calibration can be adjusted according to actual needs. While ensuring the measurement accuracy, the calibration process is optimized, unnecessary calibration operations are reduced, and the efficiency and life of the instrument are improved.

[0012] Optionally, the parameters of the preset error compensation model are adjusted based on the comparison result to obtain a target error compensation model, specifically including: when the comparison result is inaccurate, extracting the regression coefficient and the regression intercept as parameters to be adjusted; introducing a slope adjustment factor and an intercept adjustment factor, using the gradient descent method to minimize the error of the linear regression equation, and then iteratively optimizing the slope adjustment factor and the intercept adjustment factor to obtain a target regression coefficient and a target regression intercept; correcting the preset error compensation model according to the target regression coefficient and the target regression intercept to obtain the target error compensation model.

[0013] By adopting the above technical solution, the absorbance values ​​of a plurality of standard solutions of different concentrations at a preset wavelength are measured to obtain a first absorbance value set, and the linear regression equation thereof with the corresponding concentration is calculated to obtain the regression coefficient and the regression intercept. Then, the regression coefficient and the regression intercept are compared with the preset standard value, and the comparison result is judged as inaccurate or qualified according to whether the deviation exceeds the preset threshold. This method comprehensively evaluates the measurement performance and calibration status of the photoelectric colorimeter by introducing multiple standard samples and linear regression analysis, and promptly discovers and diagnoses the inaccuracy problem of the instrument. At the same time, by setting a reasonable preset threshold, the trigger conditions and frequency of the instrument calibration can be adjusted according to actual needs. While ensuring the measurement accuracy, the calibration process is optimized, unnecessary calibration operations are reduced, and the efficiency and life of the instrument are improved.

[0014] Optionally, the error of the linear regression equation is calculated as follows: Wherein, R is the error of the linear regression equation, n is the number of the standard ammonia nitrogen solutions, C i is the configuration concentration of the i-th standard ammonia nitrogen solution, A iis the theoretical absorbance value of the i-th standard ammonia nitrogen solution, a is the slope adjustment factor, k0 is the regression coefficient, b is the intercept adjustment factor, and b0 is the regression intercept.

[0015] By employing this technical solution, the goodness of fit and predictive performance of the regression equation were measured using the root mean square error (RMSE). By introducing slope and intercept adjustment factors, the parameters to be optimized were linked to the theoretical absorbance value and the configured concentration, constructing a complete error objective function. During the iterative optimization process using the gradient descent method, the optimal regression coefficient and regression intercept were obtained by continuously adjusting the slope and intercept adjustment factors to minimize the objective function value, thereby achieving adaptive correction of the error compensation model.

[0016] Optionally, after obtaining the test solution and measuring the second absorbance value of the test solution at a preset wavelength, the method further includes: determining whether the second absorbance value exceeds a preset absorbance range; if it is determined that the second absorbance value exceeds the preset absorbance range, controlling the dilution unit to dilute the test solution until the second absorbance value of the diluted test solution falls within the preset absorbance range; if it is determined that the second absorbance value does not exceed the preset absorbance range, inputting the environmental parameters, the instrument state parameters and the second absorbance value into the target error compensation model to obtain the target ammonia nitrogen concentration.

[0017] By adopting the above technical solution, after obtaining the second absorbance value of the solution to be tested, it is first determined whether it exceeds the preset absorbance range. If it exceeds the preset absorbance range, the dilution unit is controlled to automatically dilute the solution to be tested until the absorbance value after dilution falls within the preset absorbance range; if it does not exceed the preset absorbance range, the relevant parameters are directly input into the target error compensation model to calculate the target ammonia nitrogen concentration. By introducing a preset absorbance range and an automatic dilution mechanism, this method can effectively deal with fluctuations and anomalies in the concentration of the solution to be tested, avoiding distortion and misjudgment of the measurement results. At the same time, through intelligent dilution control and judgment strategies, the measurement process can be adaptively adjusted to ensure that the absorbance value is always within the optimal linear range, thereby improving the sensitivity and reproducibility of the measurement.

[0018] Optionally, before determining whether the second absorbance value exceeds the preset absorbance range, the method further includes: obtaining the absorbance values ​​of multiple historical samples; performing normal distribution fitting on the absorbance values ​​of the multiple historical samples to obtain the mean and variance of the absorbance values; subtracting the variance by a preset multiple from the mean as the lower limit of the preset absorbance range, and taking the mean plus the variance by the preset multiple as the upper limit of the preset absorbance range.

[0019] By adopting the above technical solution, the absorbance values ​​of multiple historical samples are obtained and normal distribution fitting is performed on them to obtain the mean and variance of the absorbance values. Then, the preset absorbance range is determined with the mean as the center and the preset multiples of the variance as the upper and lower limits. This method makes full use of the statistical characteristics of historical data, and automatically generates an absorbance judgment interval that is adapted to the actual sample characteristics by estimating and modeling the sample distribution. By introducing the normal distribution hypothesis and parameter estimation, the central tendency and discreteness of the absorbance value can be accurately characterized, providing a mathematical basis for setting a reasonable preset range. At the same time, by adjusting the preset multiples of the variance, the width of the preset range can be flexibly controlled to adapt to different sample types and measurement requirements.

[0020] In a second aspect of the present application, a device for compensating for ammonia nitrogen determination in water is provided, which includes: an acquisition module and a processing module, wherein: the acquisition module is used to obtain a first absorbance value of a standard ammonia nitrogen solution through a photoelectric colorimeter, and compare the first absorbance value with a preset standard absorbance value to obtain a comparison result; the processing module is used to adjust the parameters of a preset error compensation model based on the comparison result to obtain a target error compensation model; the acquisition module is also used to obtain a solution to be tested, and measure a second absorbance value of the solution to be tested at a preset wavelength, which is the maximum absorption wavelength for ammonia nitrogen determination; the acquisition module is also used to obtain environmental parameters and instrument status parameters, the environmental parameters including a target temperature and a target pH value, and the instrument status parameters including a sensor response time of the photoelectric colorimeter; the processing module is also used to input the environmental parameters, the instrument status parameters and the second absorbance value into the target error compensation model to obtain a target ammonia nitrogen concentration.

[0021] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device performs any of the methods described above.

[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions. When the instructions are executed, any one of the methods described above is executed.

[0023] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. By obtaining the first absorbance value of the standard ammonia nitrogen solution and comparing it with the preset standard absorbance value, the preset error compensation model is adaptively adjusted based on the comparison result to obtain the target error compensation model. Then, the second absorbance value of the solution to be tested is obtained, and the environmental parameters (such as temperature and pH value) and instrument state parameters (such as sensor response time) are obtained at the same time. These parameters are input into the target error compensation model to finally obtain the corrected target ammonia nitrogen concentration. Through this method, the influence of changes in environmental conditions and fluctuations in instrument status on the ammonia nitrogen determination results can be effectively overcome, adaptive compensation and dynamic calibration of the measurement process can be achieved, and the accuracy and reliability of ammonia nitrogen concentration determination can be improved. At the same time, this method reduces the workload of manual operation and calibration through automated data acquisition and intelligent model calculation, and improves measurement efficiency and practicality. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 This is a flow chart of a method for compensating for ammonia nitrogen determination error in water disclosed in an embodiment of the present application; Figure 2 This is a module schematic diagram of a device for compensating for ammonia nitrogen determination in water disclosed in an embodiment of the present application; Figure 3 This is a structural diagram of an electronic device disclosed in an embodiment of the present application.

[0025] Description of the accompanying drawings: 201, acquisition module; 202, processing module; 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0027] In the description of the embodiments of this application, words such as "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "for example" or "for instance" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "for example" or "for instance" is intended to present the relevant concepts in a concrete manner.

[0028] In the description of the embodiments of the present application, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0029] This application provides a method for compensating for the error in determining ammonia nitrogen in water. Figure 1 , Figure 1 This is a flow chart of a method for compensating for ammonia nitrogen measurement errors in water, provided in an embodiment of the present application. The method is applied to a server that executes a program for compensating for ammonia nitrogen measurement errors in water. The method includes steps S101 to S105, which are as follows: Step S101: obtaining a first absorbance value of a standard ammonia nitrogen solution by a photoelectric colorimeter, and comparing the first absorbance value with a preset standard absorbance value to obtain a comparison result.

[0030] In step S101, a first absorbance value of a standard ammonia nitrogen solution is obtained by a photoelectric colorimeter, and the first absorbance value is compared with a preset standard absorbance value to obtain a comparison result, specifically including: obtaining a plurality of standard ammonia nitrogen solutions with different concentrations, and measuring the absorbance value of each standard ammonia nitrogen solution at a preset wavelength to obtain a first absorbance value set; calculating a linear regression equation between each absorbance value in the first absorbance value set and the corresponding concentration to obtain a regression coefficient and a regression intercept; comparing the regression coefficient and the regression intercept with the preset standard value; when the deviation exceeds a preset threshold value, determining that the comparison result is inaccurate; otherwise, determining that the comparison result is qualified.

[0031] Specifically, the server establishes a communication connection with the photoelectric colorimeter and instructs it to measure the standard ammonia nitrogen solution. According to the server's instructions, the photoelectric colorimeter measures the absorbance values ​​of a variety of standard ammonia nitrogen solutions with different concentrations at a preset wavelength in sequence, and uploads the measured first absorbance value set to the server. After receiving the first absorbance value set, the server analyzes and calculates these data. Specifically, the server uses mathematical tools such as the least squares method to calculate the linear regression equation between each absorbance value in the first absorbance value set and its corresponding concentration. Through fitting, the server obtains two key parameters of the regression equation: the regression coefficient and the regression intercept. These two parameters reflect the linear relationship between the absorbance value and the ammonia nitrogen concentration, and are an important basis for subsequent error compensation.

[0032] To determine the accuracy of the current measurement result, the server compares the calculated regression coefficient and regression intercept with preset standard values. These preset standard values ​​are derived from extensive historical data and empirical experience and represent ideal values ​​for the regression equation parameters. The specific judgment rule is as follows: the server first calculates the difference between the regression coefficient and regression intercept and their corresponding standard values, and then compares the absolute value of the difference with a preset threshold. If the absolute value of the difference exceeds the preset threshold, the measurement system is considered to have significant deviation and requires calibration or maintenance. Conversely, if the absolute value of the difference is less than or equal to the threshold, the measurement system is considered to be functioning properly and subsequent measurements can proceed.

[0033] For example, suppose the server calculates a regression coefficient of 0.98 and a regression intercept of 0.05. The preset standard values ​​are 1.00 and 0.00, respectively, and the preset threshold is 0.03. For the regression coefficient, the absolute difference between it and the standard value is |0.98 - 1.00| = 0.02 < 0.03; for the regression intercept, the absolute difference between it and the standard value is |0.05 - 0.00| = 0.05 > 0.03. Based on the judgment rules, the server marks the comparison result as "inaccurate" and generates an alert message to prompt staff to address it promptly.

[0034] Step S102: adjusting the parameters of the preset error compensation model based on the comparison result to obtain a target error compensation model.

[0035] In step S102, the parameters of the preset error compensation model are adjusted based on the comparison result to obtain the target error compensation model, specifically including: when the comparison result is inaccurate, extracting the regression coefficient and the regression intercept as parameters to be adjusted; introducing the slope adjustment factor and the intercept adjustment factor, using the gradient descent method to minimize the error of the linear regression equation, and then iteratively optimizing the slope adjustment factor and the intercept adjustment factor to obtain the target regression coefficient and the target regression intercept: correcting the preset error compensation model according to the target regression coefficient and the target regression intercept to obtain the target error compensation model.

[0036] Specifically, the server extracts the parameters to be adjusted from the regression coefficient and intercept obtained in the previous step. These two parameters directly reflect the response characteristics of the measurement system and are key factors in error compensation. To quantify the extent of parameter adjustment, the server introduces two variables: the slope adjustment factor and the intercept adjustment factor. The values ​​of these two factors determine the degree of correction to the original parameters. Through continuous iterative optimization, the optimal adjustment solution can be found.

[0037] The optimization process is as follows: The server defines an objective function, namely the error of the linear regression equation. This error measures the difference between the fitted curve and the actual data points. Smaller errors indicate better fitting and more accurate compensation models. The server optimizes the objective function using gradient descent. By continuously adjusting the slope and intercept adjustment factors, the error is continuously reduced until the preset convergence condition is reached.

[0038] In each iteration, the server first calculates new regression coefficients and regression intercepts based on the current adjustment factors. These are then substituted into the linear regression equation to produce a set of predicted values. The predicted values ​​are then compared with the actual concentration of the standard ammonia nitrogen solution, and the sum of squared errors is calculated. Next, the server calculates the partial derivatives of the sum of squared errors with respect to the two adjustment factors to determine the gradient direction. Following the gradient's inverse, the server updates the adjustment factors at a fixed step size, gradually reducing the sum of squared errors. This process is repeated until the sum of squared errors falls below a set threshold or the maximum number of iterations is reached.

[0039] For example, suppose the initial regression coefficient is 0.95, the regression intercept is 0.08, the slope adjustment factor is 1.00, and the intercept adjustment factor is 0.00. In the first iteration, the server calculates a sum of squared errors of 0.12 and a gradient of (-0.03, 0.02). Therefore, the server updates the slope adjustment factor to 1.00 - 0.03 = 0.97 and the intercept adjustment factor to 0.00 + 0.02 = 0.02. After multiple iterations, the server obtains the optimal adjustment factors, resulting in a regression coefficient of 0.99, a regression intercept of 0.01, and a sum of squared errors below 0.001.

[0040] Finally, the server used the optimized target regression coefficient and target regression intercept to modify the preset error compensation model, resulting in the final target error compensation model. Compared to the initial preset error compensation model, the target model adaptively adjusted its parameters, more accurately describing the actual response characteristics of the measurement system, thereby improving the accuracy of ammonia nitrogen measurement.

[0041] In one possible implementation, the error of the linear regression equation is calculated as follows: Among them, R is the error of the linear regression equation, n is the number of standard ammonia nitrogen solutions, C i is the configuration concentration of the i-th standard ammonia nitrogen solution, A i is the theoretical absorbance value of the i-th standard ammonia nitrogen solution, a is the slope adjustment factor, k0 is the regression coefficient, b is the intercept adjustment factor, and b0 is the regression intercept.

[0042] Specifically, after obtaining the first absorbance value set and the corresponding standard ammonia nitrogen solution configuration concentration, the server will perform the following operations: First, the server calculates the error R of the linear regression equation according to the formula. This formula takes into account multiple factors, including the number of standard solutions n, the configuration concentration C of each standard solution i , the corresponding theoretical absorbance value A i , and the regression coefficient k0 and regression intercept b0 of the regression equation. In addition, two adjustment factors a and b are introduced to modify the regression coefficient and regression intercept to optimize the fitting effect. The server will traverse each standard solution and bring it into the formula for calculation. For the i-th standard solution, the server first calculates the value of the solution according to its configuration concentration C i and the theoretical absorbance value A i , calculate the theoretical absorbance value ak0A i +bb0. Then, the theoretical value is compared with the absorbance value C obtained by actual measurement. i The server compares the two solutions, calculates the difference, and squares the difference. The server repeats these steps until all n standard solutions have been calculated. The server then sums the squares of each difference, divides it by the total number n, and takes the square root to obtain the error R of the entire linear regression equation. The R value reflects the goodness of fit of the linear regression equation and indirectly indicates the accuracy of the measurement system. Generally speaking, a smaller R value indicates a better fit and a closer match between the measured result and the theoretical value. Conversely, a larger R value indicates a poorer fit and a potentially larger deviation in the measured result.

[0043] The server can set a preset R-value threshold as a criterion for determining whether the measurement system is functioning properly. If the calculated R-value is less than or equal to the preset threshold, the measurement system is considered stable and subsequent measurements can proceed. If the R-value is greater than the preset threshold, a problem may have occurred in the measurement system, requiring immediate termination of measurements. A warning message will be generated to alert personnel for calibration or maintenance.

[0044] For example, suppose the server sets an R-value threshold of 0.05. In one measurement, the server measures five standard solutions and calculates an R error of 0.03 in the linear regression equation. Since 0.03 < 0.05, the server determines that the current measurement system is operating normally and continues with the subsequent measurement. However, if, in another measurement, the calculated R-value reaches 0.08, exceeding the threshold, the server immediately interrupts the measurement process and alerts personnel, indicating a possible hardware failure or other anomaly requiring prompt investigation and resolution.

[0045] Step S103: obtaining a solution to be tested, and measuring a second absorbance value of the solution to be tested at a preset wavelength, where the preset wavelength is the maximum absorption wavelength for ammonia nitrogen determination.

[0046] In step S103, the server sends a sampling instruction to the automatic sampling system based on the preset sampling schedule and sampling location. Upon receiving the instruction, the automatic sampling system automatically collects the test solution using a sampling pump and piping system according to the predetermined sampling process. During the collection process, the automatic sampling system strictly controls the sample volume and sampling rate. After the test solution is collected, the automatic sampling system transfers the sample to the sample cell of the photoelectric colorimeter. Upon receiving the sample, the photoelectric colorimeter automatically begins measuring the absorbance value based on the measurement parameters issued by the server.

[0047] The server will specify the maximum absorption wavelength for ammonia nitrogen determination as the preset wavelength, which is generally around 420nm. The photoelectric colorimeter sets the light source and detector according to this wavelength. When the solution to be tested passes through the sample cell, the monochromatic light emitted by the light source will be absorbed by the ammonia nitrogen substance in the solution, and the degree of absorption is proportional to the ammonia nitrogen concentration. The detector receives the light signal transmitted through the solution and converts it into an electrical signal, which is sent to the signal amplification and processing circuit to finally obtain the absorbance value of the solution to be tested at the preset wavelength. The photoelectric colorimeter uploads the measured absorbance value to the server. After receiving the data, the server will perform the necessary format conversion and preprocessing to obtain a standardized second absorbance value.

[0048] After step S103, the method further includes: determining whether the second absorbance value exceeds a preset absorbance range; if it is determined that the second absorbance value exceeds the preset absorbance range, controlling the dilution unit to dilute the solution to be tested until the second absorbance value of the diluted solution to be tested falls within the preset absorbance range; if it is determined that the second absorbance value does not exceed the preset absorbance range, inputting the environmental parameters, instrument state parameters and the second absorbance value into a target error compensation model to obtain a target ammonia nitrogen concentration.

[0049] Specifically, the server has a pre-set absorbance range (typically between 0.1 and 1.0). If the second absorbance value falls within this range, the concentration of the test solution is moderate, allowing for error compensation and concentration calculation. However, if the second absorbance value exceeds this range, the test solution may be too thick or too thin, requiring appropriate adjustments.

[0050] If the second absorbance value falls outside the preset absorbance range, the server automatically triggers the dilution unit to dilute the test solution. This unit typically includes a precision metering pump and mixing device, which thoroughly mixes the test solution with pure water or another diluent according to the set dilution ratio, thereby reducing the solution's concentration. The server repeats this process until the second absorbance value of the diluted test solution falls back into the preset absorbance range.

[0051] For example, suppose the server has preset an absorbance range of 0.1-1.0. During one measurement, the second absorbance value of the test solution is 1.2, which exceeds the preset absorbance range. The server immediately activates the dilution unit and calculates a 1:1 dilution ratio based on the degree of deviation. This involves mixing the test solution with an equal volume of pure water. The diluted solution is remeasured, and the second absorbance value is 0.6, which has fallen back into the preset absorbance range. The server stops the dilution process and uses the diluted absorbance value for subsequent error compensation and concentration calculations.

[0052] If the second absorbance value does not exceed the preset absorbance value range, the server will directly input it into the target error compensation model for processing along with the previously acquired environmental parameters and instrument status parameters. The target error compensation model is obtained in step S102 by adaptively optimizing the preset error compensation model. It can comprehensively consider various influencing factors and dynamically correct the measurement results to obtain a more accurate target ammonia nitrogen concentration value. The server substitutes the environmental parameters, instrument status parameters, and the second absorbance value into the target error compensation model, and through a series of complex mathematical operations and logical judgments, it ultimately obtains the corrected ammonia nitrogen concentration value, that is, the target ammonia nitrogen concentration.

[0053] In one possible embodiment, before determining whether the second absorbance value exceeds a preset absorbance range, the method further includes: obtaining absorbance values ​​of multiple historical samples; performing normal distribution fitting on the absorbance values ​​of the multiple historical samples to obtain the mean and variance of the absorbance values; and using the mean minus the variance of a preset multiple as the lower limit of the preset absorbance range, and using the mean plus the variance of the preset multiple as the upper limit of the preset absorbance range.

[0054] Specifically, the server obtains the absorbance values ​​of a certain number of historical samples from the historical database. These historical samples come from previous measurement records and reflect the distribution of absorbance values ​​of the test solution at different times and under different conditions. After the server obtains the absorbance values ​​of the historical samples, it will fit the normal distribution to these data. Normal distribution, also known as Gaussian distribution, is a probability distribution model that can well describe the distribution patterns of many natural phenomena and experimental data. The server uses mathematical algorithms, such as maximum likelihood estimation or moment estimation, to estimate two key parameters of the normal distribution: mean and variance. The mean reflects the central tendency of the absorbance value and represents the average level of historical samples; the variance reflects the degree of dispersion of the absorbance value and represents the fluctuation range of historical samples. The server uses the calculated mean and variance as characteristic parameters of the normal distribution for subsequent preset range determination.

[0055] When determining the preset absorbance range, the server introduces a preset multiplier. This is a constant set based on experience and instrument characteristics, typically 2 or 3. The server uses the mean minus the variance of the preset multiplier as the lower limit of the preset range, and the mean plus the variance of the preset multiplier as the upper limit. This preset range covers the absorbance values ​​of most normal samples and also provides a standard for identifying abnormal values.

[0056] For example, suppose the server retrieves the absorbance values ​​of 100 samples from a historical database and, through normal distribution fitting, obtains a mean of 0.5 and a variance of 0.1. If the preset multiplier is 2, the lower limit of the preset range is 0.5 - 2 × 0.1 = 0.3, and the upper limit is 0.5 + 2 × 0.1 = 0.7. If the second absorbance value of the test solution falls between 0.3 and 0.7, it is considered normal and no dilution is required. However, if the second absorbance value is less than 0.3 or greater than 0.7, it is considered abnormal and the dilution unit needs to be activated for adjustment.

[0057] Step S104: Acquire environmental parameters and instrument status parameters, where the environmental parameters include a target temperature and a target pH value, and the instrument status parameters include a sensor response time of a photoelectric colorimeter.

[0058] In step S104, the server establishes a communication connection with the temperature sensor and the pH sensor. These sensors are installed near the sampling point of the solution to be tested and can monitor the temperature and pH of the solution in real time. The temperature sensor can be a thermal resistor, thermocouple, or digital thermometer, while the pH sensor uses a glass electrode or a composite electrode. The server will regularly send data request instructions to the sensors at preset time intervals. After receiving the instructions, the sensors will immediately sample and measure the current temperature and pH value and return the results to the server in the form of digital signals. By analyzing these digital signals, the server obtains the real-time temperature and pH value and stores them as the target temperature and target pH value, respectively.

[0059] For example, suppose a server requests data from a temperature sensor and a pH sensor every five minutes. At a certain moment, the temperature sensor returns a value of 25.3 degrees Celsius, and the pH sensor returns a value of 7.2. The server saves these two values ​​as the target temperature and target pH, respectively, for subsequent error compensation and data analysis. In addition to environmental parameters, the server also obtains instrument status parameters of the photoelectric colorimeter, the most critical of which is the sensor response time. This sensor response time reflects the speed and sensitivity of the photoelectric colorimeter to changes in absorbance and is a factor that affects the accuracy of measurement results. To obtain the sensor response time, the server communicates with the photoelectric colorimeter's control unit. The control unit integrates a dedicated time measurement circuit that records the time delay between the change in the optical signal and the output of the electrical signal. The server triggers the sensor response time measurement process by sending a specific command sequence to the control unit. Upon receiving the command, the control unit sends a pulse signal to the light source and simultaneously starts a timer. When the light signal passes through the sample cell and is received by the detector, the control unit stops the timer and sends the timing result to the server. The server calculates the sensor response time based on the received time data and uses it as one of the instrument status parameters to evaluate the performance and stability of the photoelectric colorimeter.

[0060] For example, suppose the server triggers a sensor response time measurement at a certain moment, and the control unit returns a time value of 0.5ms. The server saves this value as the current sensor response time and compares it with previous historical data. If the response time becomes significantly longer or fluctuates abnormally, the server generates an alert, prompting personnel to inspect and maintain the photoelectric colorimeter.

[0061] Step S105: Input the environmental parameters, instrument status parameters and the second absorbance value into the target error compensation model to obtain the target ammonia nitrogen concentration.

[0062] In step S105, in one possible implementation, the calculation formula of the target error compensation model is: Wherein, C is the target ammonia nitrogen concentration, A1 is the second absorbance value, E is the ideal absorbance coefficient without environmental influence, T is the target temperature, T0 is the standard temperature, p is the target pH value, p0 is the standard pH value, Q is the sensor response time of the photoelectric colorimeter, Q0 is the standard sensor response time; k, m, and α are compensation factors.

[0063] Specifically, the server first extracts the target temperature T, target pH value p, and the photoelectric colorimeter's sensor response time Q from the data acquired in step S104. These parameters reflect the actual conditions of the current measurement environment and instrument status and are key factors affecting the accuracy of the absorbance value. The server then substitutes the second absorbance value A1, the environmental parameters T and p, the instrument status parameter Q, and a series of preset constants and compensation factors into the calculation formula of the target error compensation model. During the calculation process, the server first calculates the temperature influence coefficient on the absorbance value based on the difference between the target temperature T and the standard temperature T0, as well as the temperature compensation factor k. Similarly, the server also calculates the pH influence coefficient on the absorbance value based on the difference between the target pH value p and the standard pH value p0, as well as the pH compensation factor m. These two influence coefficients are multiplied by the ideal absorbance coefficient E using an exponential function to obtain the absorbance value corrected for environmental factors. Next, the server determines the impact of the photoelectric colorimeter's sensor response time Q on the measurement result. By introducing the standard response time Q0 and the response time compensation factor α, the server uses a logarithmic function to calculate the correction factor for the response time to the absorbance value. This correction factor is added to the previously corrected environmental factor result to obtain the final absorbance value after various influencing factors. Finally, the server multiplies the corrected absorbance value by the second absorbance value A1 to obtain the target ammonia nitrogen concentration C. This result not only reflects the actual ammonia nitrogen content of the test solution but also eliminates measurement errors introduced by factors such as environmental conditions and instrument status, providing high accuracy and reliability.

[0064] Reference Figure 2 The present application also provides an error compensation device for determining ammonia nitrogen in water, which is a server. The server includes an acquisition module 201 and a processing module 202, wherein: the acquisition module 201 is used to obtain a first absorbance value of a standard ammonia nitrogen solution through a photoelectric colorimeter, and compare the first absorbance value with a preset standard absorbance value to obtain a comparison result; the processing module 202 is used to adjust the parameters of a preset error compensation model based on the comparison result to obtain a target error compensation model; the acquisition module 201 is also used to obtain a solution to be tested and measure a second absorbance value of the solution to be tested at a preset wavelength, which is the maximum absorption wavelength for ammonia nitrogen determination; the acquisition module 201 is also used to obtain environmental parameters and instrument status parameters, the environmental parameters include target temperature and target pH value, and the instrument status parameters include the sensor response time of the photoelectric colorimeter; the processing module 202 is also used to input the environmental parameters, instrument status parameters and the second absorbance value into the target error compensation model to obtain a target ammonia nitrogen concentration.

[0065] In one possible implementation, the calculation formula of the target error compensation model is: Wherein, C is the target ammonia nitrogen concentration, A1 is the second absorbance value, E is the ideal absorbance coefficient without environmental influence, T is the target temperature, T0 is the standard temperature, p is the target pH value, p0 is the standard pH value, Q is the sensor response time of the photoelectric colorimeter, Q0 is the standard sensor response time; k, m, and α are compensation factors.

[0066] In one possible embodiment, the processing module 202 obtains a first absorbance value of a standard ammonia nitrogen solution through a photoelectric colorimeter, and compares the first absorbance value with a preset standard absorbance value to obtain a comparison result, specifically including: the acquisition module 201 obtains a plurality of standard ammonia nitrogen solutions of different concentrations, and measures the absorbance value of each standard ammonia nitrogen solution at a preset wavelength to obtain a first absorbance value set; the processing module 202 calculates the linear regression equation of each absorbance value in the first absorbance value set and the corresponding concentration to obtain a regression coefficient and a regression intercept; the processing module 202 compares the regression coefficient and the regression intercept with the preset standard value. When the deviation exceeds the preset threshold, the comparison result is determined to be inaccurate; otherwise, the comparison result is determined to be qualified.

[0067] In one possible embodiment, the processing module 202 adjusts the parameters of the preset error compensation model based on the comparison result to obtain a target error compensation model, specifically including: when the comparison result is inaccurate, the processing module 202 extracts the regression coefficient and the regression intercept as parameters to be adjusted; the processing module 202 introduces a slope adjustment factor and an intercept adjustment factor, uses the gradient descent method to minimize the error of the linear regression equation, and then iteratively optimizes the slope adjustment factor and the intercept adjustment factor to obtain the target regression coefficient and the target regression intercept; the processing module 202 corrects the preset error compensation model according to the target regression coefficient and the target regression intercept to obtain the target error compensation model.

[0068] In one possible implementation, the error of the linear regression equation is calculated as follows: Among them, R is the error of the linear regression equation, n is the number of standard ammonia nitrogen solutions, C i is the configuration concentration of the i-th standard ammonia nitrogen solution, A i is the theoretical absorbance value of the i-th standard ammonia nitrogen solution, a is the slope adjustment factor, k0 is the regression coefficient, b is the intercept adjustment factor, and b0 is the regression intercept.

[0069] In one possible embodiment, after the acquisition module 201 acquires the solution to be tested and measures the second absorbance value of the solution to be tested at a preset wavelength, the method further includes: the processing module 202 determines whether the second absorbance value exceeds the preset absorbance range; if the processing module 202 determines that the second absorbance value exceeds the preset absorbance range, the dilution unit is controlled to dilute the solution to be tested until the second absorbance value of the diluted solution to be tested falls within the preset absorbance range; if the processing module 202 determines that the second absorbance value does not exceed the preset absorbance range, the environmental parameters, instrument state parameters and the second absorbance value are input into the target error compensation model to obtain the target ammonia nitrogen concentration.

[0070] In one possible embodiment, before the processing module 202 determines whether the second absorbance value exceeds the preset absorbance range, the method further includes: the acquisition module 201 acquires the absorbance values ​​of multiple historical samples; the processing module 202 performs normal distribution fitting on the absorbance values ​​of the multiple historical samples to obtain the mean and variance of the absorbance values; the processing module 202 uses the mean minus the variance of the preset multiple as the lower limit of the preset absorbance range, and the mean plus the variance of the preset multiple as the upper limit of the preset absorbance range.

[0071] It should be noted that the above embodiments provide devices that implement their functions using only the division of the above functional modules as examples. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0072] This application also provides an electronic device. Figure 3 , Figure 3 3. This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. The electronic device 300 may include: at least one processor 301, at least one network interface 304, a user interface 303, a memory 305, and at least one communication bus 302.

[0073] The communication bus 302 is used to implement the connection and communication between these components.

[0074] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.

[0075] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0076] The processor 301 may include one or more processing cores. The processor 301 utilizes various interfaces and lines to connect various parts of the entire server. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 305, and calling data stored in the memory 305, the processor 301 performs various server functions and processes data. Optionally, the processor 301 may be implemented in at least one hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 301 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display; and the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 301 and may be implemented separately on a single chip.

[0077] Among them, the memory 305 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may also be optionally at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 The memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program for a method for compensating for an error in determining ammonia nitrogen in water.

[0078] exist Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call an application program stored in the memory 305 for a method for compensating for errors in determining ammonia nitrogen in water. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited to the described order of actions, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for this application.

[0079] The present application further provides a computer-readable storage medium storing instructions, which, when executed by one or more processors 301 , enable the electronic device 300 to perform one or more of the methods described in the above embodiments.

[0080] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0081] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely schematic, such as the division of units, which is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interface, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0082] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0083] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0084] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.

[0085] The foregoing is merely an exemplary embodiment of the present disclosure and is not intended to limit the scope of the present disclosure. In other words, any equivalent variations and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the disclosure and the practical implications thereof.

[0086] This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not described herein. The description and examples are to be considered as exemplary only, and the scope and spirit of the present disclosure are to be defined by the claims.

Claims

1. A method for compensating for ammonia nitrogen determination error in water, characterized in that: The method comprises: Obtaining a first absorbance value of a standard ammonia nitrogen solution by a photoelectric colorimeter, and comparing the first absorbance value with a preset standard absorbance value to obtain a comparison result; Adjusting parameters of a preset error compensation model based on the comparison result to obtain a target error compensation model; Obtaining a solution to be tested, and measuring a second absorbance value of the solution to be tested at a preset wavelength, wherein the preset wavelength is the maximum absorption wavelength for ammonia nitrogen determination; Acquiring environmental parameters and instrument status parameters, wherein the environmental parameters include a target temperature and a target pH value, and the instrument status parameters include a sensor response time of the photoelectric colorimeter; The environmental parameters, the instrument state parameters and the second absorbance value are input into the target error compensation model to obtain a target ammonia nitrogen concentration.

2. The method according to claim 1, characterized in that The calculation formula of the target error compensation model is: Wherein, C is the target ammonia nitrogen concentration, A1 is the second absorbance value, E is the ideal absorbance coefficient without environmental influence, T is the target temperature, T0 is the standard temperature, p is the target pH value, p0 is the standard pH value, Q is the sensor response time of the photoelectric colorimeter, Q0 is the standard sensor response time; k, m, and α are compensation factors.

3. The method according to claim 1, characterized in that The method of obtaining a first absorbance value of a standard ammonia nitrogen solution by a photoelectric colorimeter and comparing the first absorbance value with a preset standard absorbance value to obtain a comparison result specifically includes: obtaining a plurality of standard ammonia nitrogen solutions of different concentrations, and measuring the absorbance value of each of the standard ammonia nitrogen solutions at the preset wavelength to obtain a first absorbance value set; Calculating a linear regression equation between each absorbance value in the first absorbance value set and the corresponding concentration to obtain a regression coefficient and a regression intercept; The regression coefficient and the regression intercept are compared with a preset standard value. When the deviation exceeds a preset threshold, the comparison result is determined to be inaccurate; otherwise, the comparison result is determined to be qualified.

4. The method according to claim 3, characterized in that The adjusting the parameters of the preset error compensation model based on the comparison result to obtain the target error compensation model specifically includes: When the comparison result is inaccuracy, extracting the regression coefficient and the regression intercept as parameters to be adjusted; Introducing a slope adjustment factor and an intercept adjustment factor, minimizing the error of the linear regression equation using a gradient descent method, and then iteratively optimizing the slope adjustment factor and the intercept adjustment factor to obtain a target regression coefficient and a target regression intercept; The preset error compensation model is corrected according to the target regression coefficient and the target regression intercept to obtain the target error compensation model.

5. The method according to claim 4, characterized in that The error calculation formula of the linear regression equation is: Wherein, R is the error of the linear regression equation, n is the number of the standard ammonia nitrogen solutions, C i is the configuration concentration of the i-th standard ammonia nitrogen solution, A i is the theoretical absorbance value of the i-th standard ammonia nitrogen solution, a is the slope adjustment factor, k0 is the regression coefficient, b is the intercept adjustment factor, and b0 is the regression intercept.

6. The method according to claim 1, characterized in that After obtaining the test solution and measuring the second absorbance value of the test solution at a preset wavelength, the method further includes: determining whether the second absorbance value exceeds a preset absorbance range; If it is determined that the second absorbance value exceeds the preset absorbance range, controlling the dilution unit to dilute the solution to be tested until the second absorbance value of the diluted solution to be tested falls within the preset absorbance range; If it is determined that the second absorbance value does not exceed the preset absorbance range, the environmental parameters, the instrument state parameters and the second absorbance value are input into the target error compensation model to obtain the target ammonia nitrogen concentration.

7. The method according to claim 6, characterized in that Before determining whether the second absorbance value exceeds a preset absorbance range, the method further includes: Obtain absorbance values ​​of multiple historical samples; Performing normal distribution fitting on the absorbance values ​​of the plurality of historical samples to obtain a mean and variance of the absorbance values; The mean value minus the variance of the preset multiple is used as the lower limit of the preset absorbance range, and the mean value plus the variance of the preset multiple is used as the upper limit of the preset absorbance range.

8. A device for compensating for the error in determining ammonia nitrogen in water, characterized in that: The device comprises an acquisition module (201) and a processing module (202), wherein: The acquisition module (201) is used to acquire a first absorbance value of a standard ammonia nitrogen solution through a photoelectric colorimeter, and compare the first absorbance value with a preset standard absorbance value to obtain a comparison result; The processing module (202) is used to adjust the parameters of the preset error compensation model based on the comparison result to obtain a target error compensation model; The acquisition module (201) is further used to acquire a solution to be tested and measure a second absorbance value of the solution to be tested at a preset wavelength, wherein the preset wavelength is the maximum absorption wavelength for ammonia nitrogen determination; The acquisition module (201) is further used to acquire environmental parameters and instrument status parameters, wherein the environmental parameters include a target temperature and a target pH value, and the instrument status parameters include a sensor response time of the photoelectric colorimeter; The processing module (202) is further configured to input the environmental parameter, the instrument status parameter, and the second absorbance value into the target error compensation model to obtain a target ammonia nitrogen concentration.

9. An electronic device, characterized in that: The electronic device (300) comprises a processor (301), a memory (305), a user interface (303) and a network interface (304), wherein the memory (305) is used to store instructions, the user interface (303) and the network interface (304) are used to communicate with other devices, and the processor (301) is used to execute the instructions stored in the memory (305) so that the electronic device (300) executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.