A rapid total nitrogen detection method for early warning

By detecting ammonia nitrogen, nitrate nitrogen, nitrosity nitrogen and pH values ​​in water quality, a linear model is established and inversion compensation is carried out in combination with pH values, and a total nitrogen sensor is used for rapid detection and early warning, the existing total nitrogen detection methods for water quality are solved, and the rapid and accurate water quality monitoring and early warning functions are achieved.

CN119804809BActive Publication Date: 2025-06-27SHANGHAI YANXUAN TECH CO LTD

Patent Information

Application Number
CN202510312253.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-06-27
Estimated Expiration
2045-03-17

AI Technical Summary

Technical Problem

The existing detection methods for total nitrogen in water quality have problems such as long detection time, needing to deal with chemical waste liquids, and insufficient real-time performance, which cannot meet the needs of on-site continuous water quality monitoring.

Method used

By detecting ammonia nitrogen, nitrate nitrogen, nitrosity nitrogen and pH values ​​in water quality, a linear model is established and inversion compensation is combined with pH values, and a total nitrogen sensor is used for rapid detection and early warning.

Benefits of technology

It has achieved rapid acquisition of the total nitrogen content of water quality, met the needs of on-site continuous monitoring, improved detection efficiency and accuracy, and promptly reminded relevant personnel of abnormal water quality through early warning functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119804809B_ABST
    Figure CN119804809B_ABST
Patent Text Reader

Abstract

The present invention discloses a rapid total nitrogen detection method for early warning, specifically related to the technical field of water quality monitoring. This method first detects and records multiple groups of data on the ammonia nitrogen value, nitrate nitrogen value, nitrite nitrogen value, pH value, and total nitrogen value at different positions in the water quality. Then, a linear model is established by summing the ammonia nitrogen, nitrate nitrogen, and nitrite nitrogen values and the total nitrogen value. Next, an accurate algorithm model is obtained by inversely compensating the total nitrogen value based on the pH value. Subsequently, the model is input into the internal system of the total nitrogen sensor connected to the early warning analysis unit. Finally, the sensor is installed in the water area to be detected for rapid detection and early warning. Its advantages are rapid detection, accurate results, and small sensor volume for easy installation, effectively solving many drawbacks of traditional total nitrogen detection methods, and can be widely applied to the water quality monitoring of various water areas, providing early warning for water eutrophication and other situations in a timely manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of water quality monitoring. More specifically, the present invention relates to a rapid total nitrogen detection method for early warning. Background Art

[0002] Total nitrogen, abbreviated as TN, is one of the important indicators for measuring water quality and is often used to indicate the degree of water body pollution by nutrients. The existing detection methods for total nitrogen in water quality are mainly chemical methods, which require sampling and laboratory testing, resulting in long detection time and problems with waste liquid recovery and treatment.

[0003] Although the current on-site total nitrogen detection instruments automate the detection steps of the chemical method and shorten the reaction digestion time, the detection still takes half an hour and cannot meet the requirements of continuous on-site water quality monitoring; the instruments need to store chemical reagents and replenish them regularly, usually once a month; and the instruments are large in size and cannot be installed in in-situ monitoring and places with installation size requirements. These problems result in the inability of total nitrogen testing instruments to effectively meet the needs of rapid water quality monitoring, allowing industrial enterprises with sewage discharge to potentially sneakily discharge or leak sewage during the detection interval blind spots.

[0004] Therefore, a rapid total nitrogen detection method for early warning is proposed. Summary of the Invention

[0005] In order to overcome the above-mentioned defects of the prior art, the present invention provides a rapid total nitrogen detection method for early warning to solve the problems raised in the above background art.

[0006] To achieve the above object, the present invention provides the following technical solution: A rapid total nitrogen detection method for early warning, comprising the following steps:

[0007] S1: Detect the ammonia nitrogen values , nitrate nitrogen values , nitrite nitrogen values , pH values and total nitrogen values at different positions in the water quality, and record multiple groups of detection data;

[0008] S2: Establish a linear model between the sum of the ammonia nitrogen values , nitrate nitrogen values and nitrite nitrogen values in each group of detections and the total nitrogen value , that is , where a is the intercept and b is the slope;

[0009] S3: Then perform inversion compensation on the total nitrogen value according to the pH value of each group of detections to obtain a more accurate total nitrogen value algorithm model as , where is the correlation coefficient;

[0010] S4: Input the algorithm model established in S3 into the internal system of the total nitrogen sensor, and a warning analysis unit is connected to the internal system of the total nitrogen sensor;

[0011] S5: Install the total nitrogen sensor in S4 in the water area to be detected, and use the total nitrogen sensor for rapid detection and warning.

[0012] Preferably, the ammonia nitrogen value, nitrate nitrogen value, nitrite nitrogen value, and pH value in the water quality measured in S1 are respectively determined by an ammonia nitrogen sensor, a nitrate nitrogen sensor, a nitrite nitrogen sensor, and a pH sensor.

[0013] Preferably, the measurement of the ammonia nitrogen value, nitrate nitrogen value, nitrite nitrogen value, and pH value in the water quality by the total nitrogen sensor is achieved through a four-parameter sensor integration method, and the method includes:

[0014] Integrate the ion-selective electrodes of ammonia nitrogen, pH, nitrate nitrogen, and nitrite nitrogen on a sealed structure;

[0015] Extract and calculate the electrode signals through the circuit and MCU in the sealed structure to obtain the ammonia nitrogen, nitrate nitrogen, nitrite nitrogen, and pH values, and then input them into the algorithm model in S3 to quickly detect the total nitrogen value.

[0016] Preferably, the method for the total nitrogen sensor to detect the nitrate nitrogen value includes measuring the spectral absorbance of the water quality at the 220nm and 300nm bands, thereby obtaining the nitrate nitrogen value. Here, the spectral absorbance of 80 wavelengths is used.

[0017] Preferably, the measurement of the ammonia nitrogen value, nitrite nitrogen value, and pH value in the water quality by the total nitrogen sensor is achieved through a detection method composed of integrating a three-parameter sensor and connecting a spectral measurement system, and the method includes:

[0018] Integrate the ion-selective electrodes of ammonia nitrogen, pH, and nitrite nitrogen on a sealed structure;

[0019] Extract and calculate the electrode signals through the circuit and MCU in the sealed structure to obtain the ammonia nitrogen, nitrite nitrogen, and pH values;

[0020] At the same time, use the spectral system to detect the nitrate nitrogen value in the water quality and perform combined detection of multiple groups of samples;

[0021] Establish a detection system through the data detected by the total nitrogen sensor and the spectral system.

[0022] Preferably, the formula of the algorithm model input into the detection system is:

[0023] Preferably, in S2, for each group of detected ammonia nitrogen values , nitrate nitrogen values and nitrite nitrogen values of the data, a linear model is established between the sum and the total nitrogen value to improve the model accuracy of self-training to obtain evaluation data, and the steps are as follows:

[0024] S2.1 Initial model training: Use the labeled dataset to train the initial model to obtain the initial model;

[0025] S2.2 Self-data annotation: Use the initial model to predict the unlabeled dataset and generate a pseudo-labeled dataset according to the prediction results;

[0026] S2.3 Self-training iteration: Combine the pseudo-labeled dataset with the labeled dataset and retrain the model to obtain an updated model; Repeat the loop steps S2.1 and S2.2 until the model accuracy reaches the preset threshold or the number of iterations reaches the preset upper limit;

[0027] S2.4 Accuracy evaluation: Evaluate the accuracy of the finally obtained model.

[0028] Preferably, in the step S2.3, the following calculation formula is used for weight update during model training:

[0029] where, : is the parameter vector of the model, which contains all the parameters to be learned in the model. For example, in a neural network, may contain the connection weights and bias terms between all neurons. represents the parameter value at the t-th iteration; represents the learning rate.

[0030] : is the learning rate, which is a hyperparameter used to control the step size of each parameter update. The learning rate determines the speed at which the model advances during optimization. If the learning rate is too large, it may cause the model to miss the optimal solution or even fail to converge; if the learning rate is too small, the training process will become very slow.

[0031] represents the loss function with respect to the model parameter gradient, represents the prediction result of the model for the input data , represents the true annotation of the data.

[0032] It should be noted that: the loss function For measuring the prediction results of the model and the true labels The difference between them, the gradient represents the direction in which the loss function rises fastest at the current parameter value Taking the negative sign indicates that the parameters are to be updated along the direction in which the loss function decreases fastest.

[0033] : is the model based on the current parameters for the input data prediction result. : is the input data, usually a vector or matrix containing multiple features, representing the input samples of the model. : is the corresponding true label or target value, corresponding to the input data and is used to supervise the training of the model.

[0034] The purpose of using this formula is to continuously update the parameters of the model so that the value of the loss function gradually decreases, thereby making the prediction result of the model as close as possible to the true label That is, to find a set of optimal parameters so that the model has the best performance on the given training data. In each iteration of this embodiment, first calculate the gradient of the loss function with respect to the current parameters , and then move the current parameters along the negative gradient direction by a step size to obtain the updated parameters . Continuously repeat this process until the loss function converges to a smaller value or reaches a preset stopping condition such as the number of iterations.

[0035] Preferably, the accurate evaluation in step S2.4 is calculated using the following formula:

[0036] Accuracy = (TP + TA) / (TP + TA + FP + FN)

[0037] where TP represents true positives, that is, the number of samples correctly predicted as positive by the model; TA represents true negatives, that is, the number of samples correctly predicted as negative by the model; FP represents false positives, that is, the number of negative class samples mispredicted as positive by the model; FN represents false negatives, that is, the number of positive class samples mispredicted as negative by the model.

[0038] Preferably, in step S2.4, through self-training iteration, the accuracy of the model on the same test set is significantly improved compared to the initial model, and the improvement amplitude is at least X%, where X is a preset accuracy improvement threshold.

[0039] Technical effects and advantages of the present invention:

[0040] 1. The total nitrogen rapid detection method of the present invention overcomes the disadvantages of traditional chemical methods, such as long detection time, the need to handle chemical waste liquid, and insufficient real-time performance. Through direct detection by the sensor, there is no need to sample and then go back to the laboratory for testing, and the results can be obtained quickly, meeting the needs of on-site continuous water quality monitoring. For example, in the embodiment, once the sensor is installed, it can monitor in real time, and once the total nitrogen value exceeds the set threshold, it can give an early warning in time, effectively improving the detection efficiency and timeliness.

[0041] 2. A linear model is established by summing the ammonia nitrogen value, nitrate nitrogen value, and nitrite nitrogen value and the total nitrogen value, and combined with the pH value for inversion compensation to obtain a more accurate total nitrogen value algorithm model. In actual scenarios, considering that the ion-selective electrode is affected by the pH value and may cause data deviation, the measured value of the pH electrode is introduced for compensation, greatly improving the accuracy of total nitrogen detection and providing reliable data support for water quality monitoring.

[0042] 3. The total nitrogen sensor is small in volume and easy to install, solving the problem that existing on-site detection instruments are large in size and cannot be installed in in-situ monitoring and occasions with installation size requirements. Whether it is installed at the lakeside monitoring station or on the water intake pipeline of the water source, it can be easily achieved, with strong adaptability and can be widely used in the monitoring of various water environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 is a schematic structural diagram of the total nitrogen sensor of the present invention;

[0044] Figure 2 is a schematic diagram of the electrode distribution structure of the total nitrogen sensor of the present invention;

[0045] Figure 3 is a schematic diagram of the data distribution in Table 1 of the present invention;

[0046] Figure 4 is a schematic diagram of the linear relationship between the total nitrogen of the present invention and the sum of the ammonia nitrogen value, nitrate nitrogen value, and nitrite nitrogen value;

[0047] Figure 5 is a linear relationship diagram between the total nitrogen value and pH of the present invention;

[0048] Figure 6 is a data chart of the influence of the total nitrogen value by pH of the present invention;

[0049] Figure 7It is a waveform diagram between the spectral wavelength of nitrate nitrogen of the present invention and the absorbance of the spectral wavelength.

[0050] Figure 8 of the present invention Figure 4 Oblique intercept form calculation sketch.

[0051] Figure 9 It is a method flow chart of the present invention. Specific implementation manners

[0052] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0053] As shown in the attached Figures 1-9 A total nitrogen rapid detection method for early warning, comprising the following steps:

[0054] S1: Detect the ammonia nitrogen values , nitrate nitrogen values , nitrite nitrogen values , pH values and total nitrogen values at different positions in the water quality, and record multiple groups of detection data;

[0055] The specific data is as shown in Table 1 below:

[0056]

[0057]

[0058] Here, the data collected by S1 is the basis for S2 to establish a linear model. Without the data collection of S1, an accurate linear model cannot be established. The data collection of S1 mainly focuses on ammonia nitrogen (mg / L), nitrate nitrogen (mg / L), nitrite nitrogen (mg / L), and total nitrogen (mg / L). Further included are ammonia nitrogen / total nitrogen (%), nitrate nitrogen / total nitrogen (%), nitrite nitrogen / total nitrogen (%), ammonia nitrogen + nitrate nitrogen + nitrite nitrogen / total nitrogen (%), and twenty-two sample cases are used for testing. The total nitrogen sensor measures the ammonia nitrogen value, nitrite nitrogen value, and pH value in water quality through a detection method composed of integrating a three-parameter sensor and connecting it with a spectral measurement system. The ion-selective electrodes for ammonia nitrogen, pH, and nitrite nitrogen are integrated on a sealed structure. This integration method can reduce the volume of the sensor and improve the convenience and efficiency of detection. The electrode signals are extracted and calculated through the circuit and MCU in the hollow rod to obtain the ammonia nitrogen, nitrite nitrogen, and pH values, making use of modern electronic technology and the processing ability of the microcontroller to achieve rapid and accurate detection of multiple parameters. At the same time, the spectral system is used to detect the nitrate nitrogen value in water quality and conduct combined detection of multiple groups of samples. This is because in actual use, the nitrate nitrogen electrode will be interfered by potassium ions, calcium ions, etc., affecting the measurement accuracy. The spectral method for detecting nitrate nitrogen has the advantages of being free from ion interference, having a lower detection limit, and higher resolution. For example, in the case of extremely low concentrations, the spectrum of nitrate nitrogen is clear and distinct, and the detection resolution can reach μg / L, while the resolution of the sensor electrode method is generally 10 μg / L. By combining the spectral method and the ion-selective electrode method, the content of various nitrogen elements can be detected more accurately, thereby improving the accuracy and reliability of total nitrogen detection. Fast and accurate: By establishing a linear model and adopting advanced detection technologies such as the spectral method, the total nitrogen content in water quality can be detected quickly and accurately, overcoming the disadvantages of long detection time and accuracy affected by various factors of the traditional chemical method. And strong anti-interference ability: Using the spectral method to detect nitrate nitrogen avoids the influence of ion interference on the detection accuracy and improves the reliability of the detection results. Especially in some special water quality environments, such as water bodies containing more potassium ions and calcium ions or in the fields of mineral water water source areas and tap water plant process monitoring with high requirements for detection accuracy, it has important application value.

[0059] The reason for choosing a linear model that needs to be explained here is that it has low requirements for data volume and data features. Low requirements for data volume: Linear models can also show good fitting effects and generalization capabilities when the amount of data is relatively small, because their simple structure is not prone to overfitting. For example, on some small data sets, linear models can converge quickly and obtain relatively reliable results. Nonlinear models usually require a large amount of data to learn complex patterns and relationships, otherwise they are prone to overfitting, resulting in poor performance on new data. Low requirements for data features: Linear models are relatively weakly dependent on data features and do not require too much preprocessing and feature engineering of the data. It can directly process numerical features, and although its ability to capture interactions and nonlinear relationships between features is limited, in some simple problems, basic features can meet the needs of the model. Nonlinear models may have high requirements for data features, and often require complex operations such as feature selection and feature extraction to mine potential information in the data and improve model performance.

[0060] S2: By measuring the ammonia nitrogen value of each group , Nitrate nitrogen value and nitrite nitrogen value The data were summed with the total nitrogen value A linear model is established between , wherein a is the intercept and b is the slope; the data of the ammonia nitrogen value, nitrate nitrogen value and nitrite nitrogen value detected in each group are summed, and a linear model is established between the total nitrogen value, i.e. y=a+bx (ammonia nitrogen+nitrate nitrogen+nitrite nitrogen). This is based on the principle that in water bodies, total nitrogen is mainly composed of ammonia nitrogen, nitrate nitrogen and nitrite nitrogen. By establishing a linear relationship between them, the total nitrogen value can be quickly estimated in the case of known ammonia nitrogen, nitrate nitrogen and nitrite nitrogen content. By analyzing and fitting a large amount of detection data, the coefficients a and b in the linear model are determined so that the model can accurately reflect the actual situation. In the present embodiment, by fitting 22 groups of data, the linear model obtained is y=0.04+0.96x (ammonia nitrogen+nitrate nitrogen+nitrite nitrogen), wherein a=0.04, b=0.96, these coefficients are obtained according to specific detection data, with pertinence and accuracy, and can provide an effective calculation basis for subsequent total nitrogen detection. Here is an explanation of the 22 sets of data: The 22 sets of data in the table are mainly used to prove the establishment of the total nitrogen early warning method, so they are samples of different rivers, illustrating the establishment of the early warning method. The data in this embodiment is 22 sets of data tables are related fitting diagrams.

[0061] In S2, the ammonia nitrogen value of each group was tested , Nitrate nitrogen value and nitrite nitrogen value The data were summed with the total nitrogen value Establish a linear model between them for self-training to improve model accuracy and obtain evaluation data, and the steps are as follows:

[0062] S2.1 Initial model training: Use the labeled dataset to train the initial model to obtain the initial model;

[0063] S2.2 Self-data annotation: Use the initial model to predict the unlabeled dataset and generate a pseudo-labeled dataset according to the prediction results;

[0064] S2.3 Self-training iteration: Merge the pseudo-labeled dataset with the labeled dataset and retrain the model to obtain an updated model; Repeat the loop steps S2.1 and S2.2 until the model accuracy reaches the preset threshold or the number of iterations reaches the preset upper limit;

[0065] S2.4 Accuracy evaluation: Evaluate the accuracy of the finally obtained model.

[0066] In step S2.3, the following calculation formula is used for weight update during model training:

[0067]

[0068] where, represents the parameters of the model at the t-th iteration, represents the learning rate, represents the loss function with respect to the model parameters gradient, represents the prediction result of the model for the input data and represents the true annotation of the data.

[0069] Preferably, the accuracy evaluation in step S2.4 is calculated using the following formula:

[0070] Accuracy = (TP + TA) / (TP + TA + FP + FN)

[0071] where, TP represents true positives, that is, the number of samples correctly predicted as positive by the model; TA represents true negatives, that is, the number of samples correctly predicted as negative by the model; FP represents false positives, that is, the number of negative samples wrongly predicted as positive by the model; FN represents false negatives, that is, the number of positive samples wrongly predicted as negative by the model.

[0072] In step S2.4, through self-training iteration, the accuracy of the model on the same test set is significantly improved compared with the initial model, and the improvement amplitude is at least X%, where X is the preset accuracy improvement threshold.

[0073] S3: Then, based on each group of detected pH values, perform inversion compensation on the total nitrogen value to obtain a more accurate total nitrogen value algorithm model as , where is the correlation coefficient.

[0074] Since the ion-selective electrode is affected by the pH value during actual use, resulting in data deviation, it is necessary to introduce a pH electrode to measure the pH value for total nitrogen compensation. By analyzing samples at different Figure 6 pH values, determine the pH correlation coefficient, thereby correcting the total nitrogen value calculated by the linear model and improving the accuracy of total nitrogen detection. In this embodiment, the obtained pH correlation coefficient is -0.08. It should be noted that -0.08 is the correlation compensation coefficient of the relevant pH for total nitrogen in (αxpH + β). According to Figure 6 , when pH = 9 and total nitrogen = 6.15, a compensation value of approximately (αxpH + β) = -0.008 is calculated according to the correlation model of pH compensation for total nitrogen. Substituting it into the algorithm model can effectively compensate for the error caused by the influence of the pH value, making the detection of the total nitrogen value more accurate, reliable, and closer to the true value.

[0075] In another embodiment, in S3: Based on each group of detected pH values, perform inversion compensation on the total nitrogen value. Each group of pH values here is the evaluation data obtained after going through the steps of S2.1 - S2.4.

[0076] S4: Input the algorithm model established in S3 into the internal system of the total nitrogen sensor, and a warning analysis unit is connected to the internal system of the total nitrogen sensor; in this step, considering how the warning threshold is set for the warning analysis unit, the inventor considered integrating the carefully established total nitrogen value algorithm model in S3 into the total nitrogen sensor. When the sensor detects data such as ammonia nitrogen, nitrate nitrogen, nitrite nitrogen, and pH value, it can quickly and automatically calculate the total nitrogen value based on the built-in algorithm model, eliminating the need for complex data processing and model operations by humans, greatly improving the detection efficiency and convenience.

[0077] Meanwhile, an early warning analysis unit is connected to the internal system of the total nitrogen sensor, and the role of this module is crucial. It will monitor and analyze the calculated total nitrogen value in real time, and compare it with a preset early warning threshold. Once the total nitrogen value exceeds this threshold, the early warning analysis unit will immediately send out an alarm signal. For example, in some waters with strict water quality requirements, such as drinking water sources and aquaculture areas, if the total nitrogen content is too high, it may indicate the risk of eutrophication, increased pollution, or other conditions that are unfavorable to the ecological balance and the survival of organisms in the water. Through this early warning mechanism, relevant personnel, such as environmental monitoring personnel, water area management personnel, and fish farmers, can learn about the abnormal total nitrogen in the water quality in a timely manner, and thus take targeted measures in a timely manner, such as strengthening water purification treatment, adjusting aquaculture strategies, and investigating pollution sources, to ensure the stability and safety of the water area ecosystem, ensure the sustainable use of water resources, and ensure the normal progress of relevant production and living activities.

[0078] Different water uses have different water quality standards. In the embodiments of the present invention, for drinking water sources, according to the "Sanitary Standards for Drinking Water" stipulated by the state, the total nitrogen content is generally required to be relatively strict. If it exceeds the value stipulated in the corresponding standard, it will pose a potential risk to human health. In this case, the early warning threshold can be set to a value less than or equal to the standard value to detect the trend of water quality deterioration in advance.

[0079] For general waters of surface water, according to the "Surface Water Environment Quality Standard", different water quality categories have different requirements for the total nitrogen content. For example, the total nitrogen standard for Class III water is about 1.0 mg / L. When monitoring such waters, the early warning threshold can be set to be close to 1.0 mg / L or slightly higher than this value, so that early warning can be given in a timely manner when the total nitrogen content approaches the critical value that may lead to a decline in the water quality category.

[0080] On the other hand: In aquaculture waters, too high a total nitrogen content may lead to excessive growth of algae, consume the dissolved oxygen in the water, and cause hypoxia and death of aquatic organisms. The setting of the early warning threshold should consider the tolerance of the cultured organisms. In the embodiments of the present invention, for fish farming waters with relatively high water quality requirements, the early warning threshold for the total nitrogen content may be set at a relatively low level, around 3 mg / L, to ensure the normal growth and survival environment of fish.

[0081] For wetland waters with ecological protection functions, even minor changes in total nitrogen content can affect the balance of the wetland ecosystem. Considering the sensitivity of wetland plants and animals to water quality, the warning threshold can be set based on research results and historical data of the wetland ecosystem, which may be more stringent than the requirements for general waters to prevent eutrophication from damaging the wetland ecology. Further, setting based on historical data is formed by recording each collected data. In the specific implementation, the total nitrogen content in the water area is normally stable between 0.5 - 1.0 mg / L, but it will increase during the rainy season or when there are agricultural activities in the surrounding area. Then, the warning threshold can be set according to the historical increase range, such as setting it to 1.5 mg / L, and a warning is issued when this value is exceeded.

[0082] High integration and small size: The total nitrogen sensor adopts the design of integrating a three-parameter sensor and connecting a spectral measurement system. It is small in size, easy to install and deploy, can be widely used in different water area environments, and reduces the detection cost and the difficulty of equipment installation. S5: Install the total nitrogen sensor in S4 in the water area to be detected, and use the total nitrogen sensor for rapid detection and warning. The total nitrogen sensor we use is mounted on the drone inspection, which not only has an advantage in volume but also realizes remote rapid detection.

[0083] Direct rapid detection through the total nitrogen sensor can solve the problems of the traditional chemical method, such as long detection time, the need to handle chemical waste liquid, avoiding secondary environmental pollution, insufficient real-time performance, and inability to meet the monitoring requirements. Moreover, the total nitrogen sensor is small in size and easy to install. Further. Install the total nitrogen sensor in S4 in the water area to be detected, and use the total nitrogen sensor for rapid detection and warning. Direct rapid detection through the total nitrogen sensor can overcome many disadvantages of the traditional chemical method, such as long detection time, the need to handle chemical waste liquid, insufficient real-time performance, etc. The total nitrogen sensor is small in size and easy to install, and can be flexibly deployed in different water area environments to achieve real-time and continuous monitoring of the total nitrogen in water quality.

[0084] At the same time, the warning function can timely remind relevant personnel of the abnormal water quality situation, so as to take corresponding measures for treatment and ensure the stability and safety of the water area ecological environment. In Example 2, the total nitrogen sensor is installed on the water intake pipeline of the water source. The total nitrogen content is monitored in real time. During the monitoring process, it is found that although the total nitrogen content of this mineral water source is generally low, there will be minor fluctuations at certain times. By detecting nitrate nitrogen through spectroscopy, ion interference is effectively avoided, and the change in nitrate nitrogen content is accurately detected. Analyzing the detection data can further understand the stability of the water quality of the water source, provide a basis for water quality guarantee for the mineral water production enterprise, ensure that the product quality meets the standards, and reflect the effectiveness and importance of the present invention in practical applications.

[0085] Such as Figure 7As shown, the above-mentioned spectroscopic method for detecting nitrate nitrogen: An example of tap water detection is added to the spectroscopic method for detecting nitrate nitrogen. Since chlorine is commonly used for disinfection and sterilization during the disinfection stage in the preparation of tap water, chloride ions will affect the measurement of the nitrate nitrogen electrode and cause interference. Therefore, using the spectroscopic method to detect nitrate nitrogen has the advantages of high precision and real-time performance, and can effectively monitor the water quality at each stage of tap water preparation. To ensure the quality of the water treatment process, the sensing instrument connected to the tap water plant system can provide an effective monitoring basis for modern unmanned tap water plants, reduce labor costs, and provide effective support for ensuring production quality.

[0086] As Figure 7 shown, the nodes in [figure] are the spectroscopic detection of water quality at some tap water process nodes. From the raw water, the effluent from the sedimentation tank, the effluent from the sand filter tank, the effluent from the carbon filter tank, and the effluent from the disinfection tank, it can be seen that the spectroscopic method has a good gradient distribution in the spectral absorption of nitrate nitrogen at about 220 nm, and can effectively monitor the low-concentration nitrate nitrogen content at each stage during the preparation of tap water.

[0087] As shown in the appendix Figure 1 and 2 shown, the role of the reference electrode is to provide a stable potential reference for the detection electrode, ensure that the potential of the working electrode remains at a fixed level, and thus ensure the accuracy of the measurement.

[0088] The role of the reference electrode in the total nitrogen sensor, that is, the reference electrode provides a stable potential reference for the detection electrode, ensures that the potential of the working electrode remains at a fixed level, and thus ensures the accuracy of the measurement. This helps to understand the working principle and structural design of the total nitrogen sensor.

[0089] As Figure 4 and Figure 8 shown, the equations in the Equation table are , which is the basic equation form of linear regression. Among them, y is the dependent variable, x is the independent variable, a is the intercept, and b is the slope. The weight term is labeled as "unweighted", which means that no different weights are assigned to the data points during the linear regression analysis. All data points are treated equally in the calculation.

[0090] The value of the intercept is 0.03023 ± 0.01645. The intercept represents the value of the dependent variable y when the independent variable x = 0. Here, the intercept has a standard error of ±0.01645. The value of the slope is 1.1317 ± 0.002675. The slope represents the average change in the dependent variable y for each unit increase in the independent variable x. Here, the slope also has a standard error of ±0.002675. The value of the sum of squared residuals is 0.00234. The sum of squared residuals is an index to measure the goodness of fit of the model, which represents the sum of the squares of the differences between the actual values and the predicted values. The smaller the sum of squared residuals, the better the model fits the data.

[0091] The value of the Pearson correlation coefficient is 0.99861. The Pearson correlation coefficient measures the strength and direction of the linear relationship between two variables. Its value ranges from -1 to 1, and the closer the absolute value is to 1, the stronger the linear relationship. Here, the correlation coefficient is negative, indicating a negative correlation between the independent variable and the dependent variable.

[0092] The value of R-squared is 0.99721. R-squared is also known as the coefficient of determination, which represents the proportion of the variation in the dependent variable that can be explained by the independent variable. Here, the R-squared value is 0.89342, indicating that the independent variable can explain approximately 89.342% of the variation in the dependent variable.

[0093] The value of the adjusted R-squared is 0.99666. The adjusted R-squared takes into account the number of independent variables in the model and adjusts the R-squared to avoid overfitting caused by too many independent variables. Its value is slightly less than the R-squared, indicating that the goodness of fit of the model is adjusted when considering the number of independent variables. Figure 8 Key statistical indicators of linear regression analysis are provided, showing the goodness of fit of the model and the relationship between variables. These indicators are very important for evaluating the reliability and effectiveness of linear regression models.

[0094] As attached Figure 7 shown, in actual use, the nitrate nitrogen electrode will be interfered by potassium ions and calcium ions, affecting the measurement accuracy. According to the data, nitrate nitrogen accounts for most of the total nitrogen content. At the same time, there are detection deviations or even situations where detection is impossible for the detection of water quality reaching class I indicators or mineral water that can be directly drunk. The spectral method for detecting nitrate nitrogen scans the spectrum of the water body, so it is not affected. At the same time, the spectral method has the advantages of a lower detection limit and higher resolution. As shown in the figure, the abscissa is the spectral wavelength of the nitrate nitrogen standard solution, and the ordinate is the absorbance corresponding to the spectral wavelength. At the same time, it can be seen from the figure that in the case of extremely low concentrations, the spectrum of nitrate nitrogen is clear and distinct, and the detection resolution can reach μg / L, while the resolution of the sensor electrode method is generally 10 μg / L.

[0095] The measurement of ammonia nitrogen value, nitrite nitrogen value and pH value in water quality by the total nitrogen sensor is realized through a detection method composed of integrating a three-parameter sensor and connecting a spectral measurement system. This method includes:

[0096] Integrate the ion-selective electrodes for ammonia nitrogen, pH, and nitrite nitrogen on a sealed structure;

[0097] Extract and calculate the electrode signals through the circuit and MCU in the sealed structure to obtain the ammonia nitrogen, nitrite nitrogen and pH values;

[0098] Meanwhile, use the spectral system to detect the nitrate nitrogen value in water quality and conduct combined detection of multiple groups of samples;

[0099] Establish a detection system through the data detected by the total nitrogen sensor and the spectral system.

[0100] The algorithm model formula input in the detection system is:

[0101] Example 1

[0102] Select a mineral water source with special geological conditions as the detection object. Prepare multiple groups of ammonia nitrogen sensors, nitrate nitrogen sensors, nitrite nitrogen sensors, pH sensors and total nitrogen sensors to ensure that the sensors are calibrated and the accuracy meets the requirements;

[0103] Conduct sampling and detection at different positions and depths in the water source area, as shown in the detection data in Table 1;

[0104] Sum up the data of the ammonia nitrogen value, nitrate nitrogen value and nitrite nitrogen value collected, and establish a linear model with the total nitrogen value. Fit 22 groups of data through data analysis software to obtain the linear model as , where a = 0.04 and b = 0.96;

[0105] Perform inversion compensation on the total nitrogen value according to the pH value of each detected group. Analyze the samples under different pH values to obtain , where, .

[0106] Input the above-established algorithm model into the internal system of the total nitrogen sensor and connect it to the early warning analysis unit. Install the total nitrogen sensor at the monitoring station on the lakeshore, and connect the sensor to the data acquisition and processing equipment on the shore through a cable to ensure real-time data transmission.

[0107] Start the sensor for continuous monitoring. When the detected total nitrogen value exceeds the set early warning threshold (such as 5 mg / L), the early warning analysis unit issues an alarm, indicating that the lake may have the risk of eutrophication, and relevant personnel can take measures for treatment and control in a timely manner.

[0108] Example 2

[0109] Select a mineral water source with special geological conditions as the detection object, and prepare high-precision ammonia nitrogen sensors, nitrate nitrogen sensors, nitrite nitrogen sensors, pH sensors and spectral measurement systems, as well as supporting data acquisition and analysis equipment;

[0110] Conduct sampling and detection at different positions and depths in the water source area, as shown in the detection data in Table 1;

[0111] A linear model is established using the collected data, and through analysis, it is obtained that , where a = 0.04 and b = 0.96;

[0112] A method of integrating three-parameter sensors and connecting them to a spectral measurement system is adopted. The ion-selective electrodes for ammonia nitrogen, pH, and nitrite nitrogen are integrated on a sealed structure, and the electrode signals are extracted and calculated through a circuit and an MCU to obtain the values of ammonia nitrogen, nitrite nitrogen, and pH; at the same time, a spectral system is used to detect the value of nitrate nitrogen, and multiple groups of samples are cooperatively detected. The established algorithm model of the detection system is input into the system. The total nitrogen sensor is installed on the water intake pipeline of the water source area to monitor the total nitrogen content in real time.

[0113] During the monitoring process, it is found that although the total nitrogen content in the mineral water water source area is generally low, there are slight fluctuations in some periods. By detecting nitrate nitrogen through spectrometry, ion interference is effectively avoided, and the change in the nitrate nitrogen content is accurately detected. Analyzing the detection data can further understand the water quality stability of the water source area, provide a basis for water quality guarantee for mineral water production enterprises, and ensure that the product quality meets the standards.

[0114] The above is collectively referred to as a sealed structure, which can be rod-shaped or square. Here, the sealing performance of the sealed structure is selected to meet the IP68 sealed structure standard, which can achieve complete dust prevention. And it can be continuously immersed in water at a certain depth for a long time (test under specific conditions, such as 1-meter water depth).

[0115] After the above embodiments, for each group of detected ammonia nitrogen values 、nitrate nitrogen values and nitrite nitrogen values of the data, a linear model is established between the sum and the total nitrogen value to improve the model accuracy of self-training to obtain evaluation data. The steps are as follows:

[0116] S2.1 Initial model training: Use the labeled dataset to train the initial model to obtain the initial model;

[0117] S2.2 Self-data annotation: Use the initial model to predict the unlabeled dataset and generate a pseudo-labeled dataset according to the prediction results;

[0118] S2.3 Self-training iteration: Combine the pseudo-labeled dataset with the labeled dataset and retrain the model to obtain the updated model; Repeat the loop steps S2.1 and S2.2 until the model accuracy reaches the preset threshold or the number of iterations reaches the preset upper limit;

[0119] S2.4 Accuracy evaluation: Evaluate the accuracy of the finally obtained model.

[0120] Preferably, in the step S2.3, the model training updates the weights using the following calculation formula:

[0121] where : is the parameter vector of the model, which contains all the parameters to be learned in the model. For example, in a neural network, may contain the connection weights and bias terms between all neurons. represents the parameter value at the t-th iteration; represents the learning rate.

[0122] : is the learning rate, which is a hyperparameter used to control the step size of each parameter update. The learning rate determines the speed at which the model progresses during optimization. If the learning rate is too large, it may cause the model to miss the optimal solution and even fail to converge; if the learning rate is too small, the training process will become very slow.

[0123] represents the loss function with respect to the model parameters gradient, represents the predicted result of the model for the input data and represents the true annotation of the data.

[0124] It should be noted that: the loss function is used to measure the difference between the model's predicted result and the true label . The gradient represents the direction in which the loss function rises fastest at the current parameter value . Taking the negative sign means updating the parameters along the direction in which the loss function decreases fastest.

[0125] : is the predicted result of the model based on the current parameters for the input data . : is the input data, usually a vector or matrix containing multiple features, representing the input samples of the model. : is the corresponding true label or target value, corresponding to the input data and used to supervise the training of the model.

[0126] The purpose of using this formula is to continuously update the model's parameters so that the value of the loss function gradually decreases, thereby making the model's predicted result as close as possible to the true label , that is, to find a set of optimal parameters , so that the model has the best performance on the given training data. In each iteration of this embodiment, first calculate the gradient of the loss function with respect to the current parameters , and then move the current parameters along the negative gradient direction by a step size to obtain the updated parameters . Continuously repeat this process until the loss function converges to a smaller value or reaches a preset stopping condition such as the number of iterations. .

[0127] Preferably, the exact evaluation in step S2.4 is calculated using the following formula:

[0128] Accuracy = (TP + TA) / (TP + TA + FP + FN)

[0129] where TP represents true positives, that is, the number of samples that the model correctly predicts as the positive class; TA represents true negatives, that is, the number of samples that the model correctly predicts as the negative class; FP represents false positives, that is, the number of negative class samples that the model incorrectly predicts as the positive class; FN represents false negatives, that is, the number of positive class samples that the model incorrectly predicts as the negative class.

[0130] Preferably, in step S2.4, through self-training iteration, the accuracy of the model on the same test set is significantly improved compared to the initial model, and the improvement amplitude is at least X%, where X is a preset accuracy improvement threshold.

[0131] Finally, several points should be noted: First, in the description of the present invention, it should be noted that unless otherwise specified and limited, the terms "installation", "connection", and "connection" should be understood in a broad sense, which can be mechanical connection or electrical connection, or the communication inside two components, and can be directly connected. "Up", "down", "left", "right", etc. are only used to represent relative position relationships. When the absolute position of the described object changes, the relative position relationship may change;

[0132] Second: In the drawings of the disclosed embodiments of the present invention, only the structures related to the disclosed embodiments are involved. Other structures can refer to the general design. Without conflict, the same embodiment and different embodiments of the present invention can be combined with each other;

[0133] Finally: The above description is only the preferred embodiments of the present invention and is not used to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A rapid detection method for total nitrogen for early warning, characterized in that: The following steps are involved: S1: Ammonia nitrogen values ​​at different locations in water quality , Nitrate nitrogen value , Nitrite nitrogen value , pH value and total nitrogen value Conduct tests and record multiple sets of test data; S2: By measuring the ammonia nitrogen value of each group , Nitrate nitrogen value and nitrite nitrogen value The data were summed with the total nitrogen value A linear model is established between , where a is the intercept and b is the slope; S3: Then the total nitrogen value is inverted and compensated according to each group of pH values ​​detected to obtain a more accurate total nitrogen value algorithm model: , is the correlation coefficient; S4: inputting the algorithm model established in S3 into the internal system of the total nitrogen sensor, and connecting an early warning analysis unit to the internal system of the total nitrogen sensor; S5: Install the total nitrogen sensor in S4 in the detected water area, and use the total nitrogen sensor to perform rapid detection and early warning; The ammonia nitrogen value, nitrite nitrogen value, nitrate nitrogen value and pH value measured at different locations in the water quality in S1 are achieved by integrating a three-parameter sensor and connecting a spectral measurement system to form a detection method, which includes: The ion-selective electrodes for ammonia nitrogen, pH, and nitrite nitrogen are integrated into a sealed structure; The electrode signals are extracted and solved through the circuit in the hollow rod and the MCU to obtain the ammonia nitrogen, nitrite nitrogen and pH value; At the same time, the nitrate nitrogen value in the water quality is detected using a spectral measurement system, and multiple groups of samples are tested; A detection system was established using data measured by a total nitrogen sensor and a spectral system.

2. A rapid detection method for total nitrogen for early warning according to claim 1, characterized in that: In S2, the ammonia nitrogen value of each group was tested , Nitrate nitrogen value and nitrite nitrogen value The data were summed with the total nitrogen value A linear model is established between them to improve the accuracy of the self-training model. The steps are as follows: S2.1 Initial model training: Use the labeled data set to train the initial model to obtain the initial model; S2.2 Self-data labeling: using the initial model to predict the unlabeled data set, and generating a pseudo-labeled data set based on the prediction results; S2.3 self-training iteration: merging the pseudo-annotated dataset with the annotated dataset, retraining the model, and obtaining an updated model; Repeat steps S2.1 and S2.2 until the model accuracy reaches a preset threshold or the number of iterations reaches a preset upper limit; S2.4 Accuracy evaluation: Perform accuracy evaluation on the final model.

3. A rapid detection method for total nitrogen for early warning according to claim 2, characterized in that: In step S2.3, the model training uses the following calculation formula to update the weights: in, represents the parameters of the model at the tth iteration, represents the learning rate, Represents the loss function About Model Parameters The gradient of Represents the model's response to input data The prediction results, Indicates the true label of the data.

4. A rapid detection method for total nitrogen for early warning according to claim 3, characterized in that: The exact evaluation in step S2.4 is calculated using the following formula: Accuracy=(TP+TA) / (TP+TA+FP+FN) Among them, TP represents true positive examples, that is, the number of samples correctly predicted by the model as positive; TA represents true negative examples, that is, the number of samples correctly predicted by the model as negative; FP represents false positive examples, that is, the number of negative samples incorrectly predicted by the model as positive; FN represents false negative examples, that is, the number of positive samples incorrectly predicted by the model as negative.

5. A rapid detection method for total nitrogen for early warning according to any one of claims 2 to 4, characterized in that: In step S2.4, through self-training iterations, the accuracy of the model on the same test set is significantly improved compared to the initial model, with the improvement being at least X%, where X is a preset accuracy improvement threshold.

Citation Information

Patent Citations

  • Riverway water quality monitoring and early warning system

    CN111855935A

  • Aquaculture water environment early warning regulation and control method, device and system

    CN112986157A

  • Continuous online monitoring method and system for total phosphorus and total nitrogen

    CN114564699A

Cited By

  • Dynamic monitoring method and system suitable for industrial sewage total nitrogen standard exceeding risk

    CN122217942A