Nitrogen concentration prediction method based on long short-term memory algorithm

Through the nitrogen concentration prediction method based on long and short-term memory algorithm, a linear relationship and deep learning model of historical data of ammonia nitrogen and total nitrogen are constructed, which solves the problems of large data demand and low accuracy in the existing technology, and achieves high accuracy and adaptability of nitrogen concentration prediction.

CN119809049APending Publication Date: 2025-04-11QINGDAO SPRING WATER TREATMENT +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411972449.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The existing ammonia nitrogen concentration prediction methods have problems such as large data demand, high investment cost, low data utilization rate, poor prediction accuracy and adaptability.

Method used

The nitrogen concentration prediction method based on long and short-term memory algorithm is used to construct a linear relationship between the historical data of ammonia nitrogen and total nitrogen, and the calibration coefficient k is obtained, which is used to calibrate the prediction boundary, and the deep learning algorithm is used to construct the ammonia nitrogen and total nitrogen concentration prediction model to correct the prediction value and update the model in real time.

Benefits of technology

It significantly improves prediction accuracy and model adaptability, reduces prediction complexity and workload, and ensures the stability and reliability of prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119809049A_ABST
    Figure CN119809049A_ABST
Patent Text Reader

Abstract

The invention discloses a nitrogen concentration prediction method based on a long short-term memory algorithm, and belongs to the field of water treatment.The method specifically comprises the steps that a primary linear relation of ammonia nitrogen and total nitrogen is built based on historical data of the ammonia nitrogen and the total nitrogen, a calibration coefficient k is obtained, and a prediction boundary is confirmed through the calibration coefficient k; constructing an ammonia nitrogen and total nitrogen concentration prediction model by using a deep learning algorithm to obtain ammonia nitrogen and total nitrogen concentration prediction values; the ammonia nitrogen and ammonia nitrogen concentration prediction values are tested according to the prediction boundary; and constructing an ammonia nitrogen and total nitrogen loss function, and correcting the ammonia nitrogen and total nitrogen concentration prediction model by using the ammonia nitrogen and total nitrogen loss function. The prediction accuracy is remarkably improved. Through the test of the prediction result, the accuracy of the model prediction result is ensured, and the prediction quality is improved. And a feedback matrix is introduced, so that the prediction model can be updated in real time according to the actual water quality change condition. It is ensured that the model can keep high precision under different operation conditions, and the stability and reliability of the system are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of ammonia nitrogen and total nitrogen concentration prediction in water treatment, and in particular to a nitrogen concentration prediction method based on a long short-term memory algorithm. Background Art

[0002] The accuracy of the sewage inlet water quality data determines the rationality of the operation of the sewage plant, and thus provides a guarantee for the stable compliance of the sewage plant's effluent quality and energy saving and consumption reduction. However, in the actual operation of the sewage plant, due to the accuracy and life of the instrument, there is instability in the water quality measurement data, which brings many unstable factors to the operation control of the sewage plant and the stable compliance of the effluent water quality. Therefore, in addition to improving the accuracy of the inlet water quality instrument, on the other hand, it is necessary to find a short-term alternative solution when individual instruments malfunction, so as to avoid greater losses.

[0003] The current prior art is: CN118886529A provides a method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model, which first obtains water quality monitoring data of the sewage treatment plant, and performs outlier cleaning and smoothing on the water quality monitoring data to obtain processed data; then the processed data is normalized, and training set data and test set data are constructed; based on a genetic algorithm, the LSTM neural network is improved to obtain an improved LSTM neural network; the improved LSTM neural network is trained using the training set data to obtain a water quality prediction model; the test set data is input into the water quality prediction model to obtain water quality prediction data. CN107664682 A discloses a water quality soft measurement prediction method for ammonia nitrogen. The method forms a data sample set by acquiring data values ​​of multiple water quality monitoring indicators including ammonia nitrogen in the water environment to be tested, and further divides the data into a training set and a test set. The training set is trained using a fuzzy neural network algorithm to obtain an ammonia nitrogen soft measurement model; the model is tested using the test set, and the model establishment and testing are repeatedly performed until the obtained test results meet the preset conditions, and the ammonia nitrogen soft measurement model that meets the preset conditions is used as the final soft measurement model. CN118298962A discloses a method for predicting influent ammonia nitrogen concentration based on a long-short-term memory step sequence, which first constructs prediction input data and output data, and pre-processes the data, then constructs an ammonia nitrogen prediction model based on a long-short-term memory step sequence to predict the ammonia nitrogen concentration, then sets the model parameters to improve the prediction accuracy, and finally simulates the influent ammonia nitrogen concentration of a sewage treatment plant, and evaluates the prediction performance of the model. CN117711521A discloses a method for predicting the ammonia nitrogen content of compost using an artificial intelligence model, which obtains environmental parameters and ammonia nitrogen content information during the composting process of organic solid waste to be predicted, and inputs the obtained information into a constructed elastic network to screen the optimal environmental parameter combination that affects the ammonia nitrogen content, and then inputs the optimal environmental parameter combination data into an artificial neural network to predict the ammonia nitrogen content.

[0004] The problems with the prior art are: ① The amount of data required is large and the investment cost is high. CN107664682A mentioned that in the implementation method, 24 water quality indicators were selected for modeling through three modelings; CN117711521A mentioned that the environmental information to be predicted in the composting process of organic solid waste includes many parameters such as number of days, temperature, total carbon, total nitrogen, compost volume, pH value, moisture content, carbon-nitrogen ratio, seed germination rate, conductivity, etc.; the influencing factors of ammonia nitrogen concentration in CN118298962A include many indicators such as pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility. Too many indicators require the support of instrument probes, which also increases investment costs.

[0005] ② Low data utilization. CN107664682A optimizes the model through repeated training and testing, which increases development costs and may also lead to a long model training cycle, affecting the speed and efficiency of practical applications. Excessive data demand also complicates data collection and processing, reducing the response speed and flexibility of the system.

[0006] ③ Poor prediction accuracy. Its input data is completely based on instrument measurement data, and it is impossible to rule out the confusion of correlation caused by poor instrument measurement accuracy, which in turn affects the accuracy of the model. In addition, a single model is difficult to handle complex and changeable water quality conditions, especially when facing different types of sewage, which may lead to a decrease in prediction accuracy.

[0007] ④ Lack of dynamic adjustment mechanism. The model is fixed and cannot be updated in real time according to the prediction results, which may easily lead to the prediction results deviating further and further from the true value in the long-term application process; CN118886529A relies on an improved LSTM neural network model. Although the model parameters are optimized by genetic algorithms, it still lacks flexibility and adaptability when applied to different projects or different types of water quality.

[0008] In summary, although the existing ammonia nitrogen concentration prediction methods have achieved monitoring and prediction functions to a certain extent, they still have problems such as large data requirements, high costs, low data utilization, poor prediction accuracy and adaptability in practical applications. These problems limit the widespread application and effect improvement of existing technologies in the field of sewage treatment. Summary of the invention

[0009] In view of the problems existing in the prior art, the present invention provides a nitrogen concentration prediction method based on a long short-term memory algorithm.

[0010] The present invention adopts the following technical solutions:

[0011] A nitrogen concentration prediction method based on long short-term memory algorithm comprises the following steps:

[0012] Step 1: Based on the historical data of ammonia nitrogen concentration and total nitrogen concentration, a linear relationship between ammonia nitrogen concentration and total nitrogen concentration is constructed to obtain a calibration coefficient k, and the calibration coefficient k is used to confirm the prediction boundary of ammonia nitrogen concentration and the prediction boundary of total nitrogen concentration;

[0013] Step 2: Use the deep learning algorithm to construct an ammonia nitrogen concentration prediction model and a total nitrogen concentration prediction model, use the ammonia nitrogen concentration prediction model to predict the ammonia nitrogen concentration and obtain the ammonia nitrogen concentration prediction value; use the total nitrogen concentration prediction model to predict the total nitrogen concentration and obtain the total nitrogen concentration prediction value;

[0014] Step 3: Verify the predicted value of ammonia nitrogen concentration with the predicted boundary of ammonia nitrogen concentration, and verify the predicted value of total nitrogen concentration with the predicted boundary of total nitrogen concentration;

[0015] Step 4: Construct an ammonia nitrogen loss function for the predicted value and standard value of ammonia nitrogen concentration, and use the ammonia nitrogen loss function to correct the ammonia nitrogen concentration prediction model; construct a total nitrogen loss function for the predicted value and standard value of total nitrogen concentration, and use the total nitrogen loss function to correct the total nitrogen concentration prediction model.

[0016] Preferably, the historical data of ammonia nitrogen and total nitrogen refer to n ammonia nitrogen and total nitrogen data for m consecutive days, and the average value AN of the historical data of ammonia nitrogen is obtained. S , the average value of the historical data of total nitrogen TN S , then the linear relationship between ammonia nitrogen and total nitrogen is:

[0017]

[0018] Then the predicted boundary of ammonia nitrogen concentration is ((ka)·TNs, (k+a)·TNs);

[0019] The predicted boundary of total nitrogen concentration is (ANs / (ka), ANs / (k+a));

[0020] When 0.55<k≤0.75, a is 0.1; when 0.75<k≤0.95, a is 0.05.

[0021] Preferably, step 2 specifically includes:

[0022] Step 2.1: Collect ammonia nitrogen data, total nitrogen data and auxiliary variable data for n consecutive days each day, where the auxiliary variable data include chemical oxygen demand, suspended solids concentration, pH value and water temperature;

[0023] Step 2.2: Obtain a first training set, in which ammonia nitrogen data is output value, total nitrogen data and auxiliary variable data are input value, and the first training set is sent to the ammonia nitrogen concentration prediction model to train the model;

[0024] Obtain a second training set, in which total nitrogen data is output value, ammonia nitrogen data and auxiliary variable data are input value, and the second training set is sent to the total nitrogen concentration prediction model to train the model;

[0025] Step 2.3: After the ammonia nitrogen concentration prediction model is trained, the total nitrogen data and auxiliary variable data corresponding to the ammonia nitrogen concentration value to be predicted are input into the ammonia nitrogen concentration prediction model to obtain the ammonia nitrogen concentration prediction value;

[0026] After the total nitrogen concentration prediction model is trained, the ammonia nitrogen data and auxiliary variable data corresponding to the total nitrogen concentration value to be predicted are input into the total nitrogen concentration prediction model to obtain the total nitrogen concentration prediction value.

[0027] Preferably, step 3 specifically includes: if the predicted ammonia nitrogen concentration value is within the predicted ammonia nitrogen concentration boundary range, then the predicted ammonia nitrogen concentration value is normal;

[0028] If the predicted value of ammonia nitrogen concentration exceeds the predicted boundary range of ammonia nitrogen concentration, the prediction result is considered abnormal. At this time, if the predicted value of ammonia nitrogen concentration is lower than (ka)·TNs, (ka)·TNs is used as the predicted value of ammonia nitrogen concentration; if the predicted value of total nitrogen concentration is higher than (k+a)·TNs, (k+a)·TNs is used as the predicted value of ammonia nitrogen concentration;

[0029] If the predicted total nitrogen concentration value is within the predicted total nitrogen concentration boundary range, the predicted total nitrogen concentration value is normal;

[0030] If the predicted value of total nitrogen concentration exceeds the prediction boundary range, the prediction result is considered abnormal. At this time, if the predicted value of total nitrogen concentration is lower than ANs / (ka), ANs / (ka) is used as the predicted value of total nitrogen concentration; if the predicted value of total nitrogen concentration is higher than ANs / (k+a), ANs / (k+a) is used as the predicted value of total nitrogen concentration.

[0031] Preferably, step 4 specifically includes:

[0032] Step 4.1: Construct the ammonia nitrogen loss function of the predicted value and standard value of ammonia nitrogen concentration. The ammonia nitrogen loss function L1 is:

[0033]

[0034] Wherein, i is the prediction number of the ammonia nitrogen concentration prediction model; ANp(i) is the i-th ammonia nitrogen concentration prediction value obtained by the ammonia nitrogen concentration prediction model, and ANt(i) is the standard value corresponding to the i-th ammonia nitrogen concentration prediction value;

[0035] If the predicted value of ammonia nitrogen concentration ANp(i) for the i-th time is lower than (ka)·TNs, then ANt(i) is (ka)·TNs;

[0036] If the predicted value of ammonia nitrogen concentration ANp(i) for the i-th time is higher than (k+a)·TNs, then ANt(i) is (k+a)·TNs;

[0037] If the predicted value of ammonia nitrogen concentration ANp(i) for the i-th time is within the predicted boundary range of ammonia nitrogen concentration, then ANt(i) = ANp(i);

[0038] The total nitrogen loss function of the predicted value and standard value of total nitrogen concentration was constructed. The total nitrogen loss function L2 is:

[0039]

[0040] Wherein, j is the prediction number of the total nitrogen concentration prediction model; TNp(j) is the j-th total nitrogen concentration prediction value obtained by the total nitrogen concentration prediction model, and TNt(j) is the standard value corresponding to the j-th ammonia nitrogen concentration prediction value;

[0041] If the j-th predicted value of ammonia nitrogen concentration TNp(j) is lower than ANs / (ka), then TNt(j) takes ANs / (ka);

[0042] If the j-th predicted value of ammonia nitrogen concentration TNp(j) is higher than ANs / (k+a), then TNt(j) takes ANs / (k+a);

[0043] If the j-th predicted value of ammonia nitrogen concentration TNp(j) is within the predicted boundary range of total nitrogen concentration, then TNt(j) = TNp(j);

[0044] Step 4.2: If the proportion of abnormal ammonia nitrogen concentration prediction results is greater than 30% within a week, the ammonia nitrogen concentration prediction model is considered to be unstable, and the ammonia nitrogen concentration prediction model is further optimized to minimize the ammonia nitrogen loss function L1;

[0045] If the proportion of abnormal total nitrogen concentration prediction results is greater than 30% within one week, the total nitrogen concentration prediction model is considered to be unstable, and the total nitrogen concentration prediction model will continue to be optimized to minimize the total nitrogen loss function L2.

[0046] The present invention has the following beneficial effects:

[0047] 1. Significantly improve the prediction accuracy. Through the prediction result test, the accuracy of the model prediction results is guaranteed and the prediction quality is improved. In practical applications, this method can ensure that the deviation between the prediction results and the true value within one month is less than 5%, which is significantly better than the common error range in the prior art.

[0048] 2. Enhance the adaptability and robustness of the model. The feedback matrix is ​​introduced to enable the prediction model to be updated in real time according to the actual water quality changes. This ensures that the model can maintain high accuracy under different operating conditions and enhances the stability and reliability of the system. Using this method, it can be guaranteed that the deviation between the prediction result and the true value is less than 15% within 3 months.

[0049] 3. Reduce prediction complexity and workload. Through a rigorous feature selection process, the problem of large and frequent measurements is reduced, reducing the workload and computational cost of prediction by more than 50%. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 Schematic diagram of the predicted ammonia nitrogen concentration and the actual ammonia nitrogen value in Example 1.

[0051] Figure 2This is a schematic diagram of the predicted value and the actual value of the total nitrogen concentration when k is 0.6 and a is 0.15 in Comparative Example 1.

[0052] Figure 3 This is a schematic diagram of the predicted value and the actual value of the total nitrogen concentration when k is 0.6 and a is 0.1 in Comparative Example 1.

[0053] Figure 4 This is a schematic diagram of the predicted value and the actual value of the total nitrogen concentration when k is 0.6 and a is 0.05 in Comparative Example 1.

[0054] Figure 5 This is a schematic diagram of the predicted value and the actual value of ammonia nitrogen concentration when k is 0.8 and a is 0.05 in Comparative Example 2.

[0055] Figure 6 This is a schematic diagram of the predicted value and actual value of ammonia nitrogen concentration when k is 0.8 and a is 0.1 in Comparative Example 2.

[0056] Figure 7 This is a schematic diagram of the predicted value and actual value of ammonia nitrogen concentration when k is 0.8 and a is 0.02 in Comparative Example 2.

[0057] Figure 8 This is a schematic diagram of the predicted value and actual value of ammonia nitrogen concentration in Comparative Example 3. DETAILED DESCRIPTION

[0058] The specific implementation of the present invention is further described below in conjunction with the accompanying drawings and specific embodiments:

[0059] When the ammonia nitrogen meter is damaged, the ammonia nitrogen concentration value cannot be detected by the ammonia nitrogen meter. The following method is used to accurately predict the ammonia nitrogen concentration.

[0060] Step 1: Construct a linear relationship between ammonia nitrogen and total nitrogen based on the historical data of ammonia nitrogen and total nitrogen, obtain the calibration coefficient k, and use the calibration coefficient k to confirm the prediction boundary of ammonia nitrogen concentration.

[0061] The historical data of ammonia nitrogen and total nitrogen refer to the data of 24 ammonia nitrogen and total nitrogen per day for 90 consecutive days, and the average value of the historical data of ammonia nitrogen is obtained. S , the average value of the historical data of total nitrogen TN s , then the linear relationship between ammonia nitrogen and total nitrogen is:

[0062]

[0063] In order to verify the rationality of the predicted ammonia nitrogen concentration in the subsequent process, the parameter a was introduced, and the linear relationship coefficient between ammonia nitrogen and total nitrogen was combined to determine the ammonia nitrogen prediction boundary as ((ka)·TNs, (k+a)·TNs).

[0064] When 0.55<k≤0.75, a is 0.1; when 0.75<k≤0.95, a is 0.05.

[0065] Step 2: Use the deep learning algorithm to build an ammonia nitrogen concentration prediction model, and use the ammonia nitrogen concentration prediction model to predict the ammonia nitrogen concentration to obtain the predicted value of the ammonia nitrogen concentration.

[0066] Specifically include: Step 2.1: Collect 24 ammonia nitrogen data and auxiliary variable data for 90 consecutive days, where the auxiliary variable data include total nitrogen, chemical oxygen demand, suspended solids concentration, pH value and water temperature. The ammonia nitrogen data and auxiliary variable data collected here are consistent with the historical data of ammonia nitrogen and total nitrogen.

[0067] Step 2.2: Obtain the first training set, in which the ammonia nitrogen data is the output value, and the total nitrogen data and auxiliary variable data are the input values. The first training set is sent to the ammonia nitrogen concentration prediction model to train the model.

[0068] Step 2.3: After the ammonia nitrogen concentration prediction model is trained, the auxiliary variable data corresponding to the ammonia nitrogen concentration value to be predicted is input into the ammonia nitrogen concentration prediction model to obtain the predicted ammonia nitrogen concentration value.

[0069] Step 3: Verify the predicted ammonia nitrogen concentration value with the predicted ammonia nitrogen concentration boundary.

[0070] Specifically: if the predicted ammonia nitrogen concentration value is within the predicted ammonia nitrogen concentration boundary range, the predicted ammonia nitrogen concentration value is normal.

[0071] If the predicted value of ammonia nitrogen concentration exceeds the predicted boundary range of ammonia nitrogen concentration, the prediction result is considered abnormal. At this time, if the predicted value of ammonia nitrogen concentration is lower than (ka)·TNs, (ka)·TNs is used as the predicted value of ammonia nitrogen concentration; if the predicted value of total nitrogen concentration is higher than (k+a)·TNs, (k+a)·TNs is used as the predicted value of ammonia nitrogen concentration.

[0072] Step 4: Construct an ammonia nitrogen loss function for the predicted value and standard value of ammonia nitrogen concentration, and use the ammonia nitrogen loss function to correct the ammonia nitrogen concentration prediction model.

[0073] Specifically include: Step 4.1: Construct the ammonia nitrogen loss function of the predicted value and standard value of ammonia nitrogen concentration, the ammonia nitrogen loss function L1 is:

[0074]

[0075] Wherein, i is the prediction number of the ammonia nitrogen concentration prediction model; ANp(i) is the i-th ammonia nitrogen concentration prediction value obtained by the ammonia nitrogen concentration prediction model, and ANt(i) is the standard value corresponding to the i-th ammonia nitrogen concentration prediction value;

[0076] If the predicted value of ammonia nitrogen concentration ANp(i) for the i-th time is lower than (ka)·TNs, then ANt(i) is (ka)·TNs;

[0077] If the predicted value of ammonia nitrogen concentration ANp(i) for the i-th time is higher than (k+a)·TNs, then ANt(i) is (k+a)·TNs;

[0078] If the i-th predicted value of ammonia nitrogen concentration ANp(i) is within the predicted boundary range of ammonia nitrogen concentration, then ANt(i) = ANp(i).

[0079] Step 4.2: If the proportion of abnormal prediction results is greater than 30% within one week, the ammonia nitrogen concentration prediction model is considered to be unstable, and the ammonia nitrogen concentration prediction model is then optimized to minimize the loss function L.

[0080] When the total nitrogen meter is damaged, the total nitrogen concentration value cannot be detected by the total nitrogen meter. The following method is used to accurately predict the total nitrogen concentration.

[0081] Step 1: Based on the historical data of ammonia nitrogen concentration and total nitrogen concentration, a linear relationship between ammonia nitrogen concentration and total nitrogen concentration is constructed to obtain the calibration coefficient k, and the calibration coefficient k is used to confirm the prediction boundary of total nitrogen concentration.

[0082] The historical data of ammonia nitrogen and total nitrogen refer to the data of n ammonia nitrogen and total nitrogen per day for m consecutive days, and the average value AN of the historical data of ammonia nitrogen is obtained. S , the average value of the historical data of total nitrogen TN S , then the linear relationship between ammonia nitrogen and total nitrogen is:

[0083]

[0084] Then the predicted boundary of total nitrogen concentration is (ANs / (ka), ANs / (k+a));

[0085] When 0.55<k≤0.75, a is 0.1; when 0.75<k≤0.95, a is 0.05.

[0086] Step 2: Use the deep learning algorithm to build a total nitrogen concentration prediction model, use the total nitrogen concentration prediction model to predict the total nitrogen concentration, and obtain the total nitrogen concentration prediction value.

[0087] Specifically include: Step 2.1: Collect ammonia nitrogen data, total nitrogen data and auxiliary variable data for n consecutive days every day, where the auxiliary variable data include chemical oxygen demand, suspended solids concentration, pH value and water temperature.

[0088] Step 2.2: Obtain a second training set, in which the total nitrogen data is the output value, and the ammonia nitrogen data and auxiliary variable data are the input values. The second training set is sent to the total nitrogen concentration prediction model to train the model.

[0089] Step 2.3: After the total nitrogen concentration prediction model is trained, the ammonia nitrogen data and auxiliary variable data corresponding to the total nitrogen concentration value to be predicted are input into the total nitrogen concentration prediction model to obtain the total nitrogen concentration prediction value.

[0090] Step 3: Verify the predicted value of total nitrogen concentration with the predicted boundary of total nitrogen concentration.

[0091] Specifically: if the predicted value of total nitrogen concentration is within the predicted boundary range of total nitrogen concentration, the predicted value of total nitrogen concentration is normal.

[0092] If the predicted value of total nitrogen concentration exceeds the prediction boundary range, the prediction result is considered abnormal. At this time, if the predicted value of total nitrogen concentration is lower than ANs / (ka), ANs / (ka) is used as the predicted value of total nitrogen concentration; if the predicted value of total nitrogen concentration is higher than ANs / (k+a), ANs / (k+a) is used as the predicted value of total nitrogen concentration.

[0093] Step 4: Construct a total nitrogen loss function for the predicted value and standard value of total nitrogen concentration, and use the total nitrogen loss function to correct the total nitrogen concentration prediction model.

[0094] Specifically include: Step 4.1: Construct the total nitrogen loss function of the total nitrogen concentration prediction value and the standard value, the total nitrogen loss function L2 is:

[0095]

[0096] Wherein, j is the prediction number of the total nitrogen concentration prediction model; TNp(j) is the j-th total nitrogen concentration prediction value obtained by the total nitrogen concentration prediction model, and TNt(j) is the standard value corresponding to the j-th ammonia nitrogen concentration prediction value;

[0097] If the j-th predicted value of ammonia nitrogen concentration TNp(j) is lower than ANs / (ka), then TNt(j) takes ANs / (ka);

[0098] If the j-th predicted value of ammonia nitrogen concentration TNp(j) is higher than ANs / (k+a), then TNt(j) takes ANs / (k+a);

[0099] If the j-th predicted value of ammonia nitrogen concentration TNp(j) is within the predicted boundary range of total nitrogen concentration, then TNt(j) = TNp(j).

[0100] Step 4.2: If the proportion of abnormal total nitrogen concentration prediction results is greater than 30% within one week, the total nitrogen concentration prediction model is considered to be unstable, and the total nitrogen concentration prediction model is then optimized to minimize the total nitrogen loss function L2.

[0101] Example 1

[0102] During the three months from September 11, 2023 to December 25, 2023, the ammonia nitrogen concentration values ​​were predicted using the method of the present invention.

[0103] from Figure 1 It can be seen that in the past three months, the predicted ammonia nitrogen concentration is not much different from the actual ammonia nitrogen value. Through calculation, it is found that in the past three months, the average of the actual ammonia nitrogen value is 42.67 mg / L, and the average of the predicted ammonia nitrogen concentration is 44.16 mg / L, so the deviation is only 3.49%.

[0104] Comparative Example 1

[0105] During the nearly four months from August 6, 2023 to December 4, 2023, the total nitrogen concentration value was predicted using the method of the present invention. Figures 2 to 4 shown.

[0106] In this comparative example, k=0.6, and a is 0.15, 0.1, and 0.5 respectively.

[0107] After four consecutive months of operation, the average true value of total nitrogen was 33.78 mg / L.

[0108] When a is 0.15, Figure 2 The mean of the predicted total nitrogen concentration was 30.72 mg / L, and the deviation was 9.06%.

[0109] When a is 0.1, Figure 3 The mean of the predicted total nitrogen concentration was 32.71 mg / L, and the deviation was 3.17%.

[0110] When a is 0.05, Figure 4 The mean of the predicted total nitrogen concentration was 29.31 mg / L, and the deviation was 13.23%.

[0111] It can be seen that when a is 0.1, the deviation between the predicted value of total nitrogen concentration and the true value of total nitrogen is the smallest, and the predicted value of total nitrogen concentration is the most accurate.

[0112] Comparative Example 2

[0113] During the three months from March 9, 2023 to July 27, 2023, the method of the present invention was used to predict the ammonia nitrogen concentration value. Figures 5 to 7shown.

[0114] In this comparative example, K=0.8, and a is 0.1, 0.05, and 0.02 respectively.

[0115] After three consecutive months of operation, the average true value of ammonia nitrogen was 46.82 mg / L.

[0116] When a is 0.05, Figure 5 In the figure, the blue mark is the actual value of ammonia nitrogen, and the red mark is the predicted value of ammonia nitrogen concentration. The mean of the predicted value of ammonia nitrogen concentration is 45.31 mg / L, and the deviation is 3.23%.

[0117] When a is 0.10, Figure 6 In the figure, the blue mark is the actual value of ammonia nitrogen, and the red mark is the predicted value of ammonia nitrogen concentration. The mean of the predicted value of ammonia nitrogen concentration is 50.36 mg / L, and the deviation is 7.56%.

[0118] When a is 0.02, Figure 7 In the figure, the blue mark is the actual value of ammonia nitrogen, and the red mark is the predicted value of ammonia nitrogen concentration. The mean of the predicted value of ammonia nitrogen concentration is 42.93 mg / L, and the deviation is 8.31%.

[0119] It can be seen that when a is 0.05, the deviation between the predicted value of ammonia nitrogen concentration and the true value of ammonia nitrogen is the smallest, and the predicted value of ammonia nitrogen concentration is the most accurate.

[0120] Comparative Example 3

[0121] The method used in this comparative example is only the process of step 1 to step 3 of the present invention, and step 4 is missing. The method of this comparative example is used to predict the ammonia nitrogen concentration value in the four months from August 10, 2024 to December 10, 2024. Figure 8 As shown. Figure 8 It can be seen that the predicted value of ammonia nitrogen concentration gradually deviates from the actual value after one month.

[0122] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the essential scope of the present invention should also fall within the protection scope of the present invention.

Claims

1. A nitrogen concentration prediction method based on long short-term memory algorithm, characterized in that: The following steps are involved: Step 1: Based on the historical data of ammonia nitrogen concentration and total nitrogen concentration, a linear relationship between ammonia nitrogen concentration and total nitrogen concentration is constructed to obtain a calibration coefficient k, and the calibration coefficient k is used to confirm the prediction boundary of ammonia nitrogen concentration and the prediction boundary of total nitrogen concentration; Step 2: Use the deep learning algorithm to construct an ammonia nitrogen concentration prediction model and a total nitrogen concentration prediction model, use the ammonia nitrogen concentration prediction model to predict the ammonia nitrogen concentration and obtain the ammonia nitrogen concentration prediction value; use the total nitrogen concentration prediction model to predict the total nitrogen concentration and obtain the total nitrogen concentration prediction value; Step 3: Verify the predicted value of ammonia nitrogen concentration with the predicted boundary of ammonia nitrogen concentration, and verify the predicted value of total nitrogen concentration with the predicted boundary of total nitrogen concentration; Step 4: Construct an ammonia nitrogen loss function for the predicted value and standard value of ammonia nitrogen concentration, and use the ammonia nitrogen loss function to correct the ammonia nitrogen concentration prediction model; construct a total nitrogen loss function for the predicted value and standard value of total nitrogen concentration, and use the total nitrogen loss function to correct the total nitrogen concentration prediction model.

2. The nitrogen concentration prediction method based on long short-term memory algorithm according to claim 1 is characterized in that: The historical data of ammonia nitrogen and total nitrogen refer to the data of n ammonia nitrogen and total nitrogen per day for m consecutive days, and the average value AN of the historical data of ammonia nitrogen is obtained. S , the average value of the historical data of total nitrogen TN S , then the linear relationship between ammonia nitrogen and total nitrogen is: Then the predicted boundary of ammonia nitrogen concentration is ((ka)·TNs, (k+a)·TNs); The predicted boundary of total nitrogen concentration is (ANs / (ka), ANs / (k+a)); When 0.55<k≤0.75, a is 0.1; when 0.75<k≤0.95, a is 0.

05.

3. The nitrogen concentration prediction method based on long short-term memory algorithm according to claim 1 is characterized in that: Step 2 specifically includes: Step 2.1: Collect ammonia nitrogen data, total nitrogen data and auxiliary variable data for n consecutive days each day, where the auxiliary variable data include chemical oxygen demand, suspended solids concentration, pH value and water temperature; use the long short-term memory network algorithm to build an ammonia nitrogen concentration prediction model and a total nitrogen concentration prediction model; Step 2.2: Obtain a first training set, in which ammonia nitrogen data is output value, total nitrogen data and auxiliary variable data are input value, and the first training set is sent to the ammonia nitrogen concentration prediction model to train the model; Obtain a second training set, in which total nitrogen data is output value, ammonia nitrogen data and auxiliary variable data are input value, and the second training set is sent to the total nitrogen concentration prediction model to train the model; Step 2.3: After the ammonia nitrogen concentration prediction model is trained, the total nitrogen data and auxiliary variable data corresponding to the ammonia nitrogen concentration value to be predicted are input into the ammonia nitrogen concentration prediction model to obtain the ammonia nitrogen concentration prediction value; After the total nitrogen concentration prediction model is trained, the ammonia nitrogen data and auxiliary variable data corresponding to the total nitrogen concentration value to be predicted are input into the total nitrogen concentration prediction model to obtain the total nitrogen concentration prediction value.

4. The nitrogen concentration prediction method based on long short-term memory algorithm according to claim 2 is characterized in that: Step 3 is specifically as follows: if the predicted value of ammonia nitrogen concentration is within the predicted boundary range of ammonia nitrogen concentration, the predicted value of ammonia nitrogen concentration is normal; If the predicted value of ammonia nitrogen concentration exceeds the prediction boundary range, the prediction result is considered abnormal. At this time, if the predicted value of ammonia nitrogen concentration is lower than (ka)·TNs, (ka)·TNs is used as the predicted value of ammonia nitrogen concentration; if the predicted value of total nitrogen concentration is higher than (k+a)·TNs, (k+a)·TNs is used as the predicted value of ammonia nitrogen concentration; If the predicted total nitrogen concentration value is within the predicted total nitrogen concentration boundary range, the predicted total nitrogen concentration value is normal; If the predicted value of total nitrogen concentration exceeds the prediction boundary range, the prediction result is considered abnormal. At this time, if the predicted value of total nitrogen concentration is lower than ANs / (ka), ANs / (ka) is used as the predicted value of total nitrogen concentration; if the predicted value of total nitrogen concentration is higher than ANs / (k+a), ANs / (k+a) is used as the predicted value of total nitrogen concentration.

5. The method for predicting nitrogen concentration based on long short-term memory algorithm according to claim 4, characterized in that: Step 4 specifically includes: Step 4.1: Construct the ammonia nitrogen loss function of the predicted value and standard value of ammonia nitrogen concentration. The ammonia nitrogen loss function L1 is: Wherein, i is the prediction number of the ammonia nitrogen concentration prediction model; ANp(i) is the i-th ammonia nitrogen concentration prediction value obtained by the ammonia nitrogen concentration prediction model, and ANt(i) is the standard value corresponding to the i-th ammonia nitrogen concentration prediction value; If the predicted value of ammonia nitrogen concentration ANp(i) for the i-th time is lower than (ka)·TNs, then ANt(i) is (ka)·TNs; If the predicted value of ammonia nitrogen concentration ANp(i) for the i-th time is higher than (k+a)·TNs, then ANt(i) is (k+a)·TNs; If the predicted value of ammonia nitrogen concentration ANp(i) for the i-th time is within the predicted boundary range of ammonia nitrogen concentration, then ANt(i) = ANp(i); The total nitrogen loss function of the predicted value and standard value of total nitrogen concentration was constructed. The total nitrogen loss function L2 is: Wherein, j is the prediction number of the total nitrogen concentration prediction model; TNp(j) is the j-th total nitrogen concentration prediction value obtained by the total nitrogen concentration prediction model, and TNt(j) is the standard value corresponding to the j-th ammonia nitrogen concentration prediction value; If the j-th predicted value of ammonia nitrogen concentration TNp(j) is lower than ANs / (ka), then TNt(j) takes ANs / (ka); If the j-th predicted value of ammonia nitrogen concentration TNp(j) is higher than ANs / (k+a), then TNt(j) takes ANs / (k+a); If the j-th predicted value of ammonia nitrogen concentration TNp(j) is within the predicted boundary range of total nitrogen concentration, then TNt(j) = TNp(j); Step 4.2: If the proportion of abnormal ammonia nitrogen concentration prediction results is greater than 30% within a week, the ammonia nitrogen concentration prediction model is considered to be unstable, and the ammonia nitrogen concentration prediction model is further optimized to minimize the ammonia nitrogen loss function L1; If the proportion of abnormal total nitrogen concentration prediction results is greater than 30% within one week, the total nitrogen concentration prediction model is considered to be unstable, and the total nitrogen concentration prediction model will continue to be optimized to minimize the total nitrogen loss function L2.

Citation Information

Patent Citations

  • Ammonia nitrogen water quality soft measurement prediction method

    CN107664682A

  • Method for predicting compost ammonia nitrogen content through artificial intelligence model

    CN117711521A

  • Inlet water ammonia nitrogen concentration prediction method based on long and short term memory step sequence

    CN118298962A

  • Sewage treatment plant water quality prediction method based on improved LSTM neural network model

    CN118886529A