Water quality pollution source reverse tracking method based on LSTM model and pollution scene database

By combining the LSTM model and pollution scenario database, the difficulty of identifying traditional water quality pollution traceability methods under limited data is solved, and rapid and accurate pollution source identification is achieved, the efficiency and adaptability of water quality management in the basin is improved, and it is suitable for complex pollution scenarios. Identification and emergency response.

CN119167034AActive Publication Date: 2024-12-20DALIAN UNIV OF TECH

Patent Information

Application Number
CN202411326247.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2024-12-20
Estimated Expiration
2044-09-23

AI Technical Summary

Technical Problem

Traditional water quality pollution traceability methods are difficult to quickly and accurately identify pollution sources and pollution types when data is limited, resulting in low emergency response efficiency for pollution incidents and difficulty in protecting the ecological environment of the river basin.

Method used

The reverse tracking method of water quality pollution source based on the LSTM model and pollution scenario database is adopted. By obtaining the characteristic parameters of the pollution source, building pollution factor migration and diffusion models, calculating residual values, training machine learning models, matching pollution scenarios, and simulating pollutants with the S-P model Concentration changes, establish a comprehensive pollution scenario database to quickly identify the types and sources of pollution.

Benefits of technology

Improve the efficiency and accuracy of pollution traceability, reduce dependence on large-scale data, enhance the adaptability and scalability of water quality management in the basin, and can provide reliable traceability results under limited monitoring data conditions, significantly speeding up pollution source tracking response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119167034A_ABST
    Figure CN119167034A_ABST
Patent Text Reader

Abstract

The invention discloses a water quality pollution source reverse tracking method based on an LSTM model and a pollution scene database, belongs to the technical field of water quality monitoring and pollution tracing, and is used for solving the problem that a pollution source and a pollution type are difficult to accurately identify under a limited data condition. According to the technical key points, a model used for describing migration and diffusion of pollution factors in a drainage basin is constructed according to a pollutant diffusion equation; mapping pollution source characteristic parameters input into the model, a pollution factor concentration change curve output by the model, a residual value and a corresponding pollution scene, and storing the mapping in a database; training a machine learning model by using the data in the database; the pollution source characteristic parameters predicted and output by the machine learning model are matched in the database, and pollution scenes corresponding to the matched pollution source characteristic parameters in the database are obtained, so that the pollution source tracking accuracy and efficiency can be effectively improved, and the method can be used for drainage basin pollution abatement and environment monitoring and early warning; and key technical support is provided for drainage basin water environment management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of water quality monitoring and pollution source tracing, and relates to a method for reverse tracing and identifying river pollution sources based on an LSTM model and a pollution scenario database, which is used for quickly determining the type and source of pollution. Background Art

[0002] Water quality monitoring and management of rivers and lakes are essential for protecting the water environment and ensuring ecological health. In water quality management, timely and accurate identification of pollution sources and their types of pollution (such as point source or non-point source pollution) is the basis for formulating and implementing effective pollution control measures. However, traditional pollution source tracing methods usually rely on a large amount of field monitoring data and complex numerical simulations. These methods are not only time-consuming and costly, but also often fail to provide fast and accurate tracing results when data is limited.

[0003] In water quality management at the basin level, water pollution incidents are often accompanied by complex pollution scenarios, including multiple pollution sources and different pollutant diffusion pathways. In this case, how to quickly identify the type and source of pollutants under limited monitoring data conditions has become a core issue facing water quality management. Solving this problem not only directly affects the efficiency of emergency response to pollution incidents, but also relates to the long-term protection of the entire basin and the sustainability of the ecosystem.

[0004] In recent years, with the development of artificial intelligence technology, models based on deep learning have gradually been applied to water quality analysis and pollution tracing. Among them, the long short-term memory (LSTM) model has shown broad application prospects due to its unique advantages in processing time series data. The LSTM model can effectively capture the temporal changes of water quality factors and, combined with measured data, can simulate the changing trend of pollutant concentrations. However, relying solely on the LSTM model for prediction is still not enough to solve problems in practical applications, especially when the pollution scenario is complex and the monitoring data is limited. Summary of the invention

[0005] In view of the problem that the prior art is difficult to accurately identify pollution sources and pollution types under limited data conditions, a water pollution source reverse tracing method according to some embodiments of the present application includes:

[0006] Obtaining characteristic parameters of pollution sources in water quality monitoring data; the characteristic parameters of pollution sources include concentration, time and location of pollution factors;

[0007] A model is constructed based on the pollutant diffusion equation to describe the migration and diffusion of pollutants in the watershed.

[0008] According to different pollution scenarios, the pollution source characteristic parameters of the water quality monitoring data are input into the model, and according to the model, the pollution factor concentration change curves in response to the input for different pollution scenarios are obtained;

[0009] Calculate the residual value of the observed value of the pollution factor concentration in each scenario and the predicted value of the pollution factor concentration of the model in response to the input output;

[0010] Mapping the pollution source characteristic parameters input into the model, the pollution factor concentration change curve output by the model, the residual value and the corresponding pollution scene is formed and stored in a database;

[0011] Using the data in the database to train a machine learning model, the input format is time series data, the input data is time series data of water quality factor concentration, and the output target is a pollution source characteristic parameter;

[0012] Inputting the time series data of measured pollution factor concentration into the trained machine learning model, and having the machine learning model predict and output characteristic parameters of pollution sources in response to the input;

[0013] Matching the pollution source characteristic parameters predicted and output by the machine learning model in the database, and obtaining the pollution scene corresponding to the matching pollution source characteristic parameters in the database;

[0014] The location information of the pollution source is obtained according to the pollution source characteristic parameters predicted and output by the machine learning model, and the pollution scene information is obtained according to the pollution scene corresponding to the pollution source characteristic parameters matched in the database.

[0015] According to the water pollution source reverse tracing method in some embodiments of the present application, the pollution scenario includes a point source pollution scenario and a non-point source pollution scenario.

[0016] According to the water pollution source reverse tracing method in some embodiments of the present application, the pollution factor includes any one of COD or ammonia nitrogen or a combination thereof.

[0017] According to the water pollution source reverse tracing method in some embodiments of the present application, the method further includes preprocessing the characteristic parameters of the pollution source, and the preprocessing includes:

[0018] Standardizing characteristic parameters of the pollution sources;

[0019] Complete the missing data points in the water quality monitoring data.

[0020] According to the water pollution source reverse tracing method in some embodiments of the present application, the model used to describe the migration and diffusion of pollution factors in the watershed includes the SP model, which is expressed by the following formula:

[0021]

[0022] Where C(x,t) is the concentration of the pollution factor at a distance x from the pollution source and time t, which represents the concentration change curve of the pollution factor. x is the distance from the pollution source and is used to represent the location. c0 is the initial concentration of the pollution factor. t is the time. D is the diffusion coefficient of the pollution factor. v is the water flow velocity.

[0023] According to the water pollution source reverse tracing method in some embodiments of the present application, it also includes evaluating the fitting accuracy of the model used to describe the migration and diffusion of pollution factors in the watershed, including: using Nash efficiency coefficient (NSE) and mean square error (MSE) statistical indicators to evaluate the fitting accuracy of the model; wherein the Nash efficiency coefficient (NSE) is used to evaluate the relative error of the model prediction value relative to the observed value; the mean square error (MSE) is used to quantify the error between the predicted value and the observed value;

[0024]

[0025] In the formula, c obs,i is the observed value at the ith time point or location, c sim,i is the predicted value at the ith time point or location, is the mean of the observations and n is the number of data points.

[0026] According to the water pollution source reverse tracing method in some embodiments of the present application, the machine learning model is the hidden layer and output layer of the LSTM model, which is represented by the following formula:

[0027] h t =σ(W x ·X t +W h ·h t-1 +b)

[0028] c pred =W0·h t +b0

[0029] In the formula, h t represents the hidden layer state, σ represents the activation function, X t is the input data, W x Represents input X t The weight matrix, h t-1 represents the hidden state at the previous moment t-1, W h Indicates the hidden state h at the previous moment t-1 The weight matrix, b represents the bias vector, which is used to add a constant correction value to the hidden state, and c pred is the predicted pollution source feature, W0 represents the weight matrix from hidden state to output, which transforms the hidden state ht Converted to output space, b0 represents the output bias.

[0030] According to the water pollution source reverse tracing method in some embodiments of the present application, the LSTM model includes an input layer, an LSTM layer and an output layer, wherein:

[0031] The input layer accepts multidimensional time series data, and each time step contains several input features, mainly including the concentration changes of water quality factors monitored in the river;

[0032] The LSTM layer processes time series data and stores long-term dependency information through memory cells, where the gate mechanism controls the flow of information; the LSTM layer includes at least two LSTM cells, and the LSTM cells include an input gate, a forget gate, and an output gate, and have candidate memory cell states, memory cell updates, and hidden state updates;

[0033] The output layer is a fully connected layer that outputs the predicted value. The activation function of the output layer selects a linear activation function.

[0034] According to the water pollution source reverse tracing method in some embodiments of the present application, the LSTM unit input gate is used to control the inflow of new information, which is expressed by the following formula:

[0035] i t =σ(W i ·[h t-1 ,x t ]+b i )

[0036] Where: i t is the activation value of the input gate, which is a value between 0 and 1, controlling the extent to which new input information flows into the memory unit; σ is the activation function, which compresses the input value to between 0 and 1; W i is the weight matrix of the input gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the input gate; h t-1 is the hidden state of the previous time step; x t is the input data of the current time step; b i is the bias term of the input gate;

[0037] Among them, the forget gate of the LSTM unit is used to control the information in the forgotten memory unit, which is expressed by the following formula:

[0038] f t =σ(W f ·[h t-1 ,x t ]+b f )

[0039] Among them, f t is the activation value of the forget gate, which is a value between 0 and 1, and controls the extent to which the information in the memory unit at the previous moment is retained or forgotten; W f is the weight matrix of the forget gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the forget gate; b f is the bias term of the forget gate;

[0040] Among them, the output gate of the LSTM unit is used to control the output information, which is expressed by the following formula:

[0041] o t =σ(W o ·[h t-1 ,x t ]+b o )

[0042] Among them, t is the activation value of the output gate, which is a value between 0 and 1, and controls the degree to which the information in the memory unit is output to the hidden state; W o is the weight matrix of the output gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the output gate; b o is the bias term of the output gate;

[0043] Among them, the candidate memory cell state of the LSTM unit is expressed by the following formula:

[0044]

[0045] in, is the candidate memory cell state, which represents the potential memory state after updating based on the current input and the hidden state of the previous time step; tanh is the hyperbolic tangent activation function, which compresses the value to between -1 and 1; W C is the weight matrix of the candidate memory unit state; b C is the bias term of the candidate memory cell state;

[0046] Among them, the memory unit update of the LSTM unit is expressed by the following formula:

[0047]

[0048] Among them, C t is the state of the memory unit at the current time step, which combines the results of the forget gate and the input gate to represent the complete memory at the current moment; C t-1 is the memory cell state of the previous time step; * indicates element multiplication;

[0049] Among them, the hidden state update of the LSTM unit is expressed as follows:

[0050] h t =o t *tanh(C t )

[0051] Among them, h t is the hidden state of the current time step, calculated based on the output gate and memory cell state; tanh(C t ) is a nonlinear transformation of the memory cell state, which is used to adjust the output amplitude.

[0052] According to the water pollution source reverse tracing method in some embodiments of the present application, the training of the machine learning model using the data in the database comprises the following steps:

[0053] The training data will be processed into time series form;

[0054] Divide the dataset into training, validation and test sets;

[0055] After the LSTM model is constructed, the model is trained and the mean square error (MSE) is selected as the loss function to measure the error between the model prediction value and the actual value, which is expressed by the following formula:

[0056]

[0057] Among them, y true,i is the actual value, y pred,i is the predicted value and n is the number of samples.

[0058] The back propagation algorithm and gradient descent optimizer are used to update the model parameters. The gradient descent optimizer is expressed by the following formula:

[0059] m t =β1m t-1 +(1-β1)g t

[0060] v t =β2v t-1 +(1-β2)g t 2

[0061]

[0062] Among them, θ t is the value of the model parameter at time step t; g t is the current gradient calculated at time step t; m t is the first-order moment estimate; v t is the second-order moment estimate; is the bias correction value of the first-order moment estimate; is the bias correction value of the second-order moment estimate; α is the learning rate; β1 is the exponentially weighted decay rate for controlling the first-order moment estimate; β2 is the exponentially weighted decay rate for controlling the second-order moment estimate; ∈ is a small constant added to prevent division by zero.

[0063] Beneficial effects:

[0064] In the first aspect, the present invention proposes a method for reverse tracing of water pollution sources by combining an LSTM model with a pollution scenario database. The SP model is used to simulate the changes in pollutant concentrations under different pollution scenarios to establish a comprehensive pollution scenario database. The database covers various possible types and sources of pollution, and can quickly identify the types and sources of pollutants by matching them with the scenarios in the database when limited monitoring data is input. This method not only improves the efficiency and accuracy of pollution tracing, but also provides strong technical support for watershed water quality management. The application of this method is of great significance to the environmental protection of the basin. On the one hand, it can help managers take timely measures when pollution incidents occur to reduce the impact of pollution on the ecological environment; on the other hand, it also provides new ideas and tools for the long-term protection and scientific management of the basin, which helps to achieve the sustainable development of the basin's ecological environment.

[0065] In the second aspect, the present invention adopts the SP model combined with simulation methods under limited data conditions, and by simulating the pollution diffusion process, it can quickly generate multiple pollution scenarios when the monitoring data is incomplete. By combining the LSTM model with the database, when there is a lack of real-time monitoring data, historical data and pollution scenario libraries can be used to provide reliable tracing results, thereby reducing dependence on large-scale data.

[0066] In the first direction of the second aspect, the present invention has strong adaptability: because the SP model is based on the pollutant diffusion equation, it can flexibly adjust parameters such as diffusion coefficient and flow rate. This makes the technology not only applicable to specific river basins, but also can be extended to other river basins or regions, with strong universality. The parameter adjustment in the model adapts to the geographical and hydrological characteristics of different river basins, so it can achieve more accurate pollution source identification under different environmental conditions.

[0067] In the second direction of the second aspect, the present invention has scalability: the scalability is reflected in the parameterization characteristics of the model and the expansion of the database. The pollution scenario database can be continuously updated to cover more pollution sources and pollution types. In addition, the structure and calculation method of the model can be adjusted to adapt to watershed systems of different sizes, and new data sources and pollutant types can be added according to needs to expand the application field.

[0068] On the third aspect, compared with the use of machine learning models alone to reversely track water pollution sources, the present invention can improve model accuracy and reliability, reduce data requirements, improve the ability to handle complex pollution scenarios, enhance adaptability and scalability, and accelerate the response speed of pollution source tracking by pre-setting the SP model, establishing a pollution scenario database, and then training the machine learning model.

[0069] In the first direction of the third aspect, the present invention can improve the accuracy and reliability of the model: the SP model is based on the pollutant diffusion equation, which can simulate the concentration changes of pollutants in different time and space and generate multiple pollution scenarios. These simulation results can provide more training data for the machine learning model, enabling it to handle complex pollution situations in practical applications and improve the accuracy of predictions. Compared with relying solely on historical data for training, this combination of simulation and learning can capture more potential pollution patterns, thereby improving the generalization ability and prediction reliability of the model.

[0070] In the second direction of the third aspect, the present invention can reduce data requirements: traditional machine learning models usually rely on a large amount of monitoring data for training, while the present invention generates simulated data through the SP model to make up for the lack of actual monitoring data. This enables the model to work effectively even when data is limited, reducing dependence on long-term, large-scale monitoring data, thereby improving the practicality of the method, especially in watersheds or environments with limited data resources. In the third direction of the third aspect, the present invention can enhance the ability to handle complex pollution scenarios: a single machine learning model may have difficulty coping with complex, multi-source pollution scenarios, and by introducing the SP model and a pollution scenario database, the present invention can simulate pollution events of different types and sources. This enables the system to quickly match current monitoring data with pollution scenarios in the database, thereby accurately identifying pollution sources and pollution types, especially in sudden or atypical pollution events. It has significant advantages.

[0071] In the fourth direction of the third aspect, the present invention can enhance adaptability and scalability: through the pre-simulation of the SP model and the establishment of a database, the present invention is not limited to a specific river basin or pollution type, and has strong adaptability and scalability. The database can be continuously expanded according to actual needs, adding different pollution scenarios, thereby improving the system's adaptability to different environments and pollution events. This scalability makes the method not only applicable to the current target river basin, but also can be promoted and applied to water quality management and pollution tracing in other regions.

[0072] In the fifth direction of the third aspect, the present invention can accelerate the response speed of pollution source tracking: since the pollution scenario database has been pre-established, when a pollution incident occurs, the model can quickly match the current data with the scenarios in the database and quickly identify the pollution source. Compared with the traditional machine learning model that relies on the gradual training and optimization process, this method significantly speeds up the emergency response speed and can provide tracing results as soon as possible after the pollution incident occurs. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 It is a flow chart of the present invention for reverse tracing of water pollution types in a river basin.

[0074] Figure 2 It is a graph of pollutant concentration changes simulated by the water quality model established by the present invention.

[0075] Figure 3 It is a pollutant concentration variation diagram corresponding to a certain pollution scenario in the database established by the present invention.

[0076] Figure 4 It is a pollutant concentration change graph predicted by the LSTM model established by the present invention. DETAILED DESCRIPTION

[0077] The present invention relates to a water pollution type reverse tracing method based on LSTM model and database, which is suitable for accurately identifying and tracing pollution sources in a river basin through a small amount of measured data, and provides strong support for river basin water quality management and rapid response to pollution incidents.

[0078] like Figure 1 As shown, a method for reverse tracing water pollution types implemented by using an LSTM model and a database includes the following steps:

[0079] Step 1: Data collection and preprocessing.

[0080] 1.1) Collect water quality monitoring data of tributaries and sources within the basin, including the concentration of key pollution factors such as COD and ammonia nitrogen, as well as corresponding time, location and other information;

[0081] 1.2) Use normalization or standardization methods to preprocess the data, such as standardizing the concentration of pollution factors. The formula is as follows:

[0082]

[0083] Among them, X is the original data, μ is the mean value, and σ is the standard deviation. The processed data is convenient for the input and training of subsequent models;

[0084] 1.3) For missing data points, interpolation or KNN methods are used to complete them to ensure the integrity and continuity of the data set.

[0085] Step 2: Construction of SP model and pollution scenario simulation.

[0086] 2.1) Set the input concentration c0(t) and input time t0 of the pollution factor, and record the geographical location of the pollution source (the distance from the source x;

[0087] 2.2) The SP model is constructed based on the pollutant diffusion equation to describe the migration and diffusion process of pollution factors in the watershed. The formula is as follows:

[0088]

[0089] Where C(x,t) is the concentration of the pollution factor at distance x and time t, D is the diffusion coefficient, and v is the flow velocity;

[0090] 2.3) Use statistical indicators such as Nash efficiency coefficient (NSE) and mean square error (MSE) to evaluate the fitting accuracy of the model to ensure that the simulation results have high accuracy. NSE is used to evaluate the relative error of the model prediction value relative to the observed value, and the value range is (-∞,1]. The closer the value is to 1, the better the model fitting effect; MSE is used to quantify the error between the simulation value and the observed value. The smaller the MSE value, the smaller the model error.

[0091]

[0092] Among them, c obs,i is the observed value at the ith time point or location, c sim,i is the simulated value at the ith time point or location, is the mean of the observations and n is the number of data points.

[0093] 2.4) According to different pollution scenarios, change the values ​​of c0, t0 and x, input them into the SP model, and simulate the concentration change curves c(x, t) of various pollutants.

[0094] 2.5) Calculate the residual value under each simulation scenario, and store the simulation results, residual values, and their corresponding input data in the pollution scenario database.

[0095] Step 3: Training and optimization of LSTM model.

[0096] 3.1) Split the data in the pollution scenario database in step 2 into a training set and a validation set. The input format is time series data in the form of [c t-n ,c t-n+1 ,…,c t-1 ,ct ], c represents the concentration of water quality factors and related characteristics at each time step, and the corresponding label is the time series data of water quality factor concentration;

[0097] 3.2) Build the LSTM model and define the structure of the hidden layer and output layer. The model form is:

[0098] h t =σ(W x ·X t +W h ·h t-1 +b)

[0099] c pred =W0·h t +b0

[0100] Among them, h t is the hidden layer state, X t is the input data, c pred is the predicted pollution source characteristics;

[0101] 3.3) The Adam optimizer is used for model training to minimize the loss function (such as MSE) between the predicted value and the true label, and the model parameters are tuned through cross-validation to ensure the generalization ability of the model.

[0102] Step 4: Backward tracing of pollution sources based on LSTM model.

[0103] 4.1) The real-time monitored water quality data [c t-n ,c t-n+1 ,…,c t-1 ,c t ], input into the trained LSTM model, the model will predict the possible pollution source parameters c0, t0 and x;

[0104] 4.2) Match the pollution source characteristics output by the LSTM model with the pollution scenario database to find the closest pollution scenario and determine the type of pollution source (point source or area source) and its specific location;

[0105] 4.3) Based on the matching results of the model and the database, a pollution source identification report is generated and fed back to the river basin management department for pollution emergency treatment and long-term management.

[0106] The beneficial effects of the present invention are as follows: by combining the SP model and the LSTM model, accurate reverse tracking of water pollution types is achieved under limited monitoring data conditions, significantly improving the accuracy and efficiency of pollution source identification.

[0107] This method reduces data requirements and has strong adaptability and scalability, providing effective technical support for river basin water environment management.

[0108] Low data demand: This technology uses the SP model combined with simulation methods under limited data conditions. By simulating the pollution diffusion process, it can quickly generate multiple pollution scenarios when monitoring data is incomplete. By combining the LSTM model with the database, historical data and pollution scenario libraries can be used to provide reliable traceability results when real-time monitoring data is lacking, thereby reducing dependence on large-scale data.

[0109] Strong adaptability: Since the SP model is based on the pollutant diffusion equation, it can flexibly adjust parameters such as diffusion coefficient and flow rate. This makes the technology not only applicable to specific river basins, but also can be extended to other river basins or regions, with strong universality. The parameter adjustment in the model adapts to the geographical and hydrological characteristics of different river basins, so it can achieve more accurate pollution source identification under different environmental conditions.

[0110] Scalability: Scalability is reflected in the parameterization characteristics of the model and the expansion of the database. The pollution scenario database can be continuously updated to cover more pollution sources and pollution types. In addition, the structure and calculation method of the model can be adjusted to adapt to watershed systems of different sizes, and new data sources and pollutant types can be added as needed to expand the application field.

[0111] Compared with the use of machine learning models alone to reversely track water pollution sources, the present invention can improve model accuracy and reliability, reduce data requirements, enhance the ability to handle complex pollution scenarios, enhance adaptability and scalability, and accelerate the response speed of pollution source tracking by pre-setting the SP model, establishing a pollution scenario database, and then training the machine learning model.

[0112] Improve model accuracy and reliability: The P model is based on the pollutant diffusion equation, which can simulate the concentration changes of pollutants in different time and space and generate multiple pollution scenarios. These simulation results can provide more training data for machine learning models, enabling them to handle complex pollution situations in practical applications and improve the accuracy of predictions. Compared with relying solely on historical data for training, this combination of simulation and learning can capture more potential pollution patterns, thereby improving the generalization ability and prediction reliability of the model.

[0113] Reduced data requirements: Traditional machine learning models usually rely on a large amount of monitoring data for training, while the present invention generates simulated data through the SP model to make up for the lack of actual monitoring data. This enables the model to work effectively even when data is limited, reducing the reliance on long-term, large-scale monitoring data, thereby improving the practicality of the method, especially in watersheds or environments with limited data resources.

[0114] Improve the ability to handle complex pollution scenarios: A single machine learning model may have difficulty coping with complex, multi-source pollution scenarios, but by introducing the SP model and pollution scenario database, the present invention can simulate pollution events of different types and sources. This enables the system to quickly match current monitoring data with pollution scenarios in the database, thereby accurately identifying pollution sources and pollution types, especially in sudden or atypical pollution events.

[0115] Enhanced adaptability and scalability: Through the pre-simulation of the SP model and the establishment of a database, the present invention is not limited to a specific river basin or pollution type and has strong adaptability and scalability. The database can be continuously expanded according to actual needs, adding different pollution scenarios, thereby improving the system's adaptability to different environments and pollution events. This scalability makes the method not only applicable to the current target river basin, but also can be promoted and applied to water quality management and pollution tracing in other regions.

[0116] Accelerate the response speed of pollution source tracking: Since the pollution scenario database has been pre-established, when a pollution incident occurs, the model can quickly match the current data with the scenarios in the database and quickly identify the pollution source. Compared with the traditional machine learning model that relies on the gradual training and optimization process, this method significantly speeds up the emergency response speed and can provide tracing results as soon as possible after the pollution incident occurs.

[0117] The present invention is further described in detail below with reference to specific embodiments.

[0118] The following is the reverse tracing process of water pollution types in the Fudu River Basin in Dalian, Liaoning Province, China.

[0119] Step 1: Data collection and preprocessing;

[0120] Obtain the historical water quality data of various monitoring points in the Fudu River Basin in recent years from the Dalian Environmental Monitoring Center, or consult the annual environmental quality report of the Dalian Local Environmental Protection Bureau to obtain the latest monitoring data on the Fudu River Basin. If historical data is insufficient, current water quality data can be obtained through field sampling. Select at least 6-8 monitoring points in the Fudu River Basin, focus on monitoring COD (chemical oxygen demand) and ammonia nitrogen concentrations, and conduct sampling 2-3 times a month. The data collection time span covers at least 1 year to capture seasonal changes in the Fudu River Basin.

[0121] The data collected from each monitoring point were preliminarily screened to remove obviously unreasonable outliers (such as data points where the COD concentration at some monitoring points was suddenly extremely high or extremely low, exceeding 3 times the standard deviation). The data were visualized using box plots or the 3σ rule to ensure that the data after elimination conformed to statistical laws. For a small number of missing values, linear interpolation was used to fill them.

[0122] The COD and ammonia nitrogen concentration data of each monitoring point are normalized or standardized to make the data more suitable for the input of the LSTM model and avoid error amplification caused by different data dimensions.

[0123] Step 2: Construction of SP model and pollution scenario simulation;

[0124] Based on the geographical and hydrological characteristics of the Fudu River, the river channel is divided into three sub-segments, each of which is used as an independent simulation unit. Under the SP model framework, each sub-segment includes the pollution source input (Source), the migration and diffusion of pollutants in the water body (Pathway), and its effect in the environment (Effect). According to the typical diffusion coefficient values ​​of similar rivers in the literature, calibration is performed in combination with measured data. Assuming the diffusion coefficient is D = 0.01m 2 / s, COD degradation coefficient is Kd_COD=0.005s -1 The degradation coefficient of ammonia nitrogen is The upstream inlet is set to a fixed pollutant concentration, and the downstream outlet is assumed to be free outflow. Based on the above parameters and measured data, the following one-dimensional transport-diffusion equation is used to simulate the pollutant concentration:

[0125]

[0126] Among them, c is the pollutant concentration (COD or ammonia nitrogen), t is the time, x is the spatial position in the river, v is the flow velocity, D is the diffusion coefficient, and Kd is the degradation coefficient.

[0127] The finite element method is used to discretize the model equations, and Python code is used to write numerical solutions to simulate the changes in the concentration of pollutants in the river over time.

[0128] The pollutant concentration change curve generated by the simulation results shows the migration and diffusion of pollutants in the river.

[0129] like Figure 2 As shown, the simulation results are compared with the measured data, and the Nash efficiency coefficient (NSE) and mean square error (MSE) are used to calibrate the model parameters to ensure the accuracy and reliability of the model. In this water quality model, the NSE of ammonia nitrogen is 0.9646, MSE is 0.0001, and the NSE of COD is 0.8903, MSE is 0.3333.

[0130] Based on the constructed water quality model, the changing trends of COD and ammonia nitrogen concentrations over time and space under various scenarios were analyzed to identify areas with high pollutant concentrations and potential environmental risk points.

[0131] Scenario 1: Point source pollution emergency:

[0132] Sudden industrial emission events were simulated in the three subsections of Fudu River. It was assumed that an enterprise had improper emissions, causing the COD concentration in the area to instantly increase to [10,15] mg / L. Based on the water quality model, the diffusion and degradation of pollutants after the pollution event were simulated.

[0133] Scenario 2: Agricultural non-point source pollution incident:

[0134] In the three subsections of Fudu River, a large amount of agricultural non-point source pollution was simulated to enter the river, causing the ammonia nitrogen concentration in the area to quickly increase to [0.5,2] mg / L in a short period of time. According to the water quality model, the diffusion and degradation of pollutants after the pollution incident were simulated, with special attention paid to the impact of rainfall on pollutant concentrations.

[0135] Calculate and count the residual data of the monitoring points. The residual calculation formula is as follows:

[0136] e i =|c obs,i -c sim,i |

[0137] Among them, c obs,i is the measured value at the ith monitoring point or time point, c sim,i is the simulated value at the ith monitoring point or time point, e i is the residual at the ith monitoring point or time point.

[0138] Use MySQL to create a relational database that contains the following main tables:

[0139] Pollution scenario table: record the parameter settings of each simulation scenario (such as input concentration, input time, etc.);

[0140] Simulation result table: record the simulated concentration values ​​of the monitoring points under each scenario;

[0141] Measured data table: stores the actually collected water quality monitoring data;

[0142] Residual table: stores the residual values ​​of each monitoring point and time node in each scenario;

[0143] Model parameter table: records the model parameter settings for each simulation (such as flow rate, diffusion coefficient, degradation coefficient, etc.).

[0144] The data of a scenario in this example database is intercepted for demonstration as shown in the following table, where: Figure 3 This is a simulation diagram of pollutant concentrations under this scenario.

[0145] Table 1 Parameter setting table for a pollution scenario in the database

[0146]

[0147] Table 2: Simulation, measurement and residual data of pollutants corresponding to this scenario (partial)

[0148]

[0149] Step 3: Training and optimization of LSTM model;

[0150] From the previously established database, extract the input data, i.e., the time series data of water quality factor concentrations, and the output targets, i.e., the characteristic parameters of pollution sources (initial concentration of pollutants, pollutant input time, and distance to pollution sources, etc.), and organize the data into a format suitable for the LSTM model, i.e., the time series form. Each input feature and target is arranged with time as the index.

[0151] The dataset is divided into training set, validation set and test set. In this example, the split ratio is 70% for training, 15% for validation and 15% for testing.

[0152] The LSTM model structure is divided into input layer, hidden layer (LSTM layer) and output layer.

[0153] The input layer accepts multidimensional time series data, and each time step contains several input features, mainly including the concentration changes of key water quality factors monitored in the river, usually as series data over time.

[0154] The LSTM layer is responsible for processing time series data, storing long-term dependency information through memory cells, and controlling the flow of information through gate mechanisms (input gate, forget gate, output gate). This example includes 1 LSTM layer and several LSTM cells. The calculation formula for a single LSTM cell is as follows:

[0155] Input gate: controls the inflow of new information

[0156] i t =σ(W i ·[h t-1 ,x t ]+b i )

[0157] Among them, i t is the activation value of the input gate (between 0 and 1), which controls the extent to which new input information flows into the memory unit; σ is the activation function (usually the sigmoid function), which compresses the input value to between 0 and 1; W i is the weight matrix of the input gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the input gate; h t-1is the hidden state of the previous time step (the output of the previous LSTM unit); x t is the input data of the current time step; b i is the bias term of the input gate.

[0158] Forget gate: controls the information in the forgotten memory unit

[0159] f t =σ(W f ·[h t-1 ,x t ]+b f )

[0160] Among them, f t is the activation value of the forget gate (between 0 and 1), which controls the extent to which the information in the memory unit at the previous moment is retained or forgotten; W f is the weight matrix of the forget gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the forget gate; b f is the bias term of the forget gate.

[0161] Output gate: controls output information

[0162] o t =σ(W o ·[h t-1 ,x t ]+b o )

[0163] Among them, t is the activation value of the output gate (between 0 and 1), which controls the degree to which the information in the memory unit is output to the hidden state; W o is the weight matrix of the output gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the output gate; b o is the bias term of the output gate.

[0164] Candidate memory cell status

[0165]

[0166] in, is the candidate memory cell state, which represents the potential memory state after updating based on the current input and the hidden state of the previous time step; tanh is the hyperbolic tangent activation function, which compresses the value to between -1 and 1; W C is the weight matrix of the candidate memory unit state; b C is the bias term of the candidate memory cell state.

[0167] Memory unit update

[0168]

[0169] Among them, C t is the state of the memory unit at the current time step, which combines the results of the forget gate and the input gate and represents the complete memory at the current moment; C t-1 is the state of the memory unit at the previous time step; * represents element multiplication (Hadamard product), which means multiplication of elements one by one.

[0170] Hide status updates

[0171] h t =o t *tanh(C t )

[0172] Among them, h t is the hidden state of the current time step (also the output of the current LSTM unit), calculated based on the output gate and the memory unit state; tanh(C t ) is a nonlinear transformation of the memory cell state, which is used to adjust the output amplitude.

[0173] The output layer is a fully connected layer that outputs predicted values ​​(initial concentration of pollutants, time of pollutant input, distance from pollution source, etc.). The activation function of the output layer uses the linear activation function because the output predicted value can be any real number.

[0174] After building the LSTM model, the model is trained and the mean square error (MSE) is selected as the loss function to measure the error between the model prediction value and the actual value.

[0175]

[0176] Among them, y true,i is the actual value, y pred,i is the predicted value and n is the number of samples.

[0177] Reasons for choosing mean square error (MSE) as the loss function:

[0178] Measuring the error between the predicted value and the actual value: In water pollution source tracing, the LSTM model needs to predict the characteristic parameters related to the pollution source (such as initial concentration, pollution time, distance, etc.). MSE measures the mean square error between the model prediction value and the actual observed value, reflecting the accuracy of the model prediction. The smaller the MSE, the closer the predicted value is to the actual value, so it is a very intuitive and commonly used error measurement method.

[0179] Penalize large errors: MSE imposes a greater penalty on larger errors in the form of squared errors, which is particularly important in water quality monitoring because large errors may mean a major misjudgment of the location or concentration of the pollution source, thereby affecting the accuracy of pollution source tracing. Therefore, MSE can effectively reduce such errors and improve the robustness of the model.

[0180] Good adaptation of continuous variables: Water quality factors (COD, ammonia nitrogen concentration) and time are continuous variables, and MSE is particularly suitable for processing continuous output data. Compared with other loss functions (such as cross entropy), MSE is more suitable for regression problems such as water quality monitoring.

[0181] Use the backpropagation algorithm (BPTT) and the gradient descent optimizer (such as the Adam optimizer) to update the model parameters. The Adam optimizer formula is as follows:

[0182] m t =β1m t-1 +(1-β1)g t

[0183] v t =β2v t-1 +(1-β2)g t 2

[0184]

[0185]

[0186] Among them, θ t is the value of the model parameter at time step t, that is, the current weight; g t is the current gradient calculated at time step t (that is, the partial derivative of the loss function with respect to the parameters); m t is the first-order moment estimate, which is the exponentially weighted moving average of the gradient (similar to the momentum term in momentum), and can also be understood as the "momentum" of the gradient; v t is the second-order moment estimate, which is the exponentially weighted moving average of the square of the gradient and is used to estimate the variance of the gradient; is the deviation correction value of the first-order moment estimate. The deviation correction is to compensate for the error in the early stage of the algorithm due to m t and v t When it is initialized to 0, it may cause deviation; is the bias correction value of the second-order moment estimate, and Similar; α is the learning rate, which controls the step size of parameter update; β1 is the exponential weighted decay rate of the first-order moment estimate, which is usually close to 1, and in this case is 0.9; β2 is the exponential weighted decay rate of the second-order moment estimate, which is usually close to 1, and in this case is 0.999; ∈ is a small constant added to prevent division by zero, which is usually 10 -8 .

[0187] Reasons for choosing the backpropagation algorithm (BPTT): Suitable for processing time series data: The LSTM model needs to process time series data of water quality factors, and BPTT is an extension of the standard backpropagation algorithm, which is suitable for processing sequence data. It propagates the error from the output layer back to the input layer by backpropagation, while taking into account the dependencies between each time step, thereby updating the parameters of the model.

[0188] Capturing long-term dependencies: In water pollution tracing, changes in water quality factors often have time dependencies and may be affected by upstream events or historical data. BPTT can help the LSTM model effectively capture this long-term dependency, enabling the model to more accurately predict future pollution conditions based on past pollution trends.

[0189] Reasons for choosing Adam optimizer: Automatically adjust the learning rate: Adam optimizer is a gradient descent optimizer with adaptive learning rate. It combines the advantages of momentum method and RMSProp, and can automatically adjust the learning rate for each parameter to accelerate convergence, which is particularly suitable for complex deep learning models such as LSTM.

[0190] Optimization that adapts to sparse or noisy data: The Adam optimizer can smooth the impact of noise and sparse data during the gradient update process. For water quality monitoring data that often has discontinuous or incomplete problems, the Adam optimizer can help the model update parameters more stably and avoid large parameter fluctuations.

[0191] Fast convergence: In the task of tracing the source of water pollution, real-time and accuracy are very important. The Adam optimizer uses momentum to accelerate gradient descent, allowing the model to converge in fewer iterations, thereby shortening the model's training time and improving the model's real-time prediction capabilities.

[0192] The model is iterated multiple times (epochs) on the training set, and is evaluated on the validation set after each iteration. Hyperparameters (such as learning rate, number of LSTM layers, number of units, etc.) are adjusted to optimize model performance.

[0193] like Figure 4As shown in the figure, NSE and MSE are used on the test set to evaluate the model performance to ensure that the model has good generalization ability. In this example, NSE = 0.85 is calculated, indicating that the model prediction effect is good, and MSE = 0.03, indicating that the model prediction error is small.

[0194] Step 4: Backward tracing of pollution sources based on LSTM model.

[0195] When a pollution incident occurs, obtain the latest water quality monitoring data from monitoring stations in the Fudu River Basin. The data should include key water quality factors such as chemical oxygen demand (COD), ammonia nitrogen concentration, etc. The new data is subjected to the same preprocessing steps, including normalization, to ensure that the scale is consistent with the training data. The water quality data is serialized to generate input sequences by time step, ready to be input into the LSTM model for prediction.

[0196] The model will output the predicted changes in water quality factor concentrations, generating a series of time series data to reflect the possible impact of pollution sources. The predicted results output by the model will be compared with the residual data under different pollution scenarios stored in the database to find the pollution scenario that best matches the current monitoring data.

[0197] Based on the comparison results, determine whether the pollution source scenario corresponding to the current monitoring data is point source pollution or non-point source pollution. This process involves analyzing the difference (residual) between the model output and the known pollution scenarios in the database, and finding the scenario closest to the actual situation. Visualize the pollution source types predicted by the model and present them through maps or charts to facilitate management personnel to understand and use.

[0198] The actual detection results and governance effects are fed back to the model database, and the pollution scenario data is updated to continuously improve the model's predictive capabilities.

[0199] The above-described embodiments merely express the implementation methods of the present invention, but they cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A method for reverse tracing of water pollution sources, characterized in that: include: Obtaining characteristic parameters of pollution sources in water quality monitoring data; the characteristic parameters of pollution sources include concentration, time and location of pollution factors; A model is constructed based on the pollutant diffusion equation to describe the migration and diffusion of pollutants in the watershed. According to different pollution scenarios, the pollution source characteristic parameters of the water quality monitoring data are input into the model, and according to the model, the pollution factor concentration change curves in response to the input for different pollution scenarios are obtained; Calculate the residual value of the observed value of the pollution factor concentration in each scenario and the predicted value of the pollution factor concentration of the model in response to the input output; Mapping the pollution source characteristic parameters input into the model, the pollution factor concentration change curve output by the model, the residual value and the corresponding pollution scene is formed and stored in a database; Using the data in the database to train a machine learning model, the input format is time series data, the input data is time series data of water quality factor concentration, and the output target is a pollution source characteristic parameter; Inputting the time series data of measured pollution factor concentration into the trained machine learning model, and having the machine learning model predict and output characteristic parameters of pollution sources in response to the input; Matching the pollution source characteristic parameters predicted and output by the machine learning model in the database, and obtaining the pollution scene corresponding to the matching pollution source characteristic parameters in the database; The location information of the pollution source is obtained according to the pollution source characteristic parameters predicted and output by the machine learning model, and the pollution scene information is obtained according to the pollution scene corresponding to the pollution source characteristic parameters matched in the database.

2. The method for reverse tracing of water pollution sources according to claim 1, characterized in that: in, The pollution scenarios include point source pollution scenarios and non-point source pollution scenarios.

3. The method for reverse tracing of water pollution sources according to claim 1, characterized in that: The pollution factors include any one of COD and ammonia nitrogen or a combination thereof.

4. The method for reverse tracing of water pollution sources according to claim 1, characterized in that: The method also includes preprocessing the characteristic parameters of the pollution source, wherein the preprocessing includes: Standardizing characteristic parameters of the pollution sources; Complete the missing data points in the water quality monitoring data.

5. The method for reverse tracing of water pollution sources according to claim 1, characterized in that: The model used to describe the migration and diffusion of pollution factors in the watershed, including the SP model, is expressed by the following formula: Where C(x,t) is the concentration of the pollution factor at a distance x from the pollution source and time t, which represents the concentration change curve of the pollution factor. x is the distance from the pollution source and is used to represent the location. c0 is the initial concentration of the pollution factor. t is the time. D is the diffusion coefficient of the pollution factor. v is the water flow velocity.

6. The method for reverse tracing of water pollution sources according to claim 1, characterized in that: The method also includes evaluating the fitting accuracy of the model used to describe the migration and diffusion of pollution factors in the watershed, including: using Nash efficiency coefficient (NSE) and mean square error (MSE) statistical indicators to evaluate the fitting accuracy of the model; wherein the Nash efficiency coefficient (NSE) is used to evaluate the relative error of the model prediction value relative to the observed value; the mean square error (MSE) is used to quantify the error between the predicted value and the observed value; In the formula, c obs,i is the observed value at the ith time point or location, c sim,i is the predicted value at the ith time point or location, is the mean of the observations and n is the number of data points.

7. The method for reverse tracing of water pollution sources according to claim 1, characterized in that: The machine learning model is the hidden layer and output layer of the LSTM model, which is represented by the following formula: h t =σ(W x ·X t +W h ·h t-1 +b) c pred =W0·h t +b0 In the formula, h t represents the hidden layer state, σ represents the activation function, X t is the input data, W x Represents input X t The weight matrix, h t-1 represents the hidden state at the previous moment t-1, W h Indicates the hidden state h at the previous moment t-1 The weight matrix, b represents the bias vector, which is used to add a constant correction value to the hidden state, and c pred is the predicted pollution source feature, W0 represents the weight matrix from hidden state to output, which transforms the hidden state h t Converted to output space, b0 represents the output bias.

8. The method for reverse tracing of water pollution sources according to claim 7, characterized in that: The LSTM model consists of an input layer, an LSTM layer, and an output layer, where: The input layer accepts multidimensional time series data, and each time step contains several input features, mainly including the concentration changes of water quality factors monitored in the river; The LSTM layer processes time series data and stores long-term dependency information through memory cells, where the gate mechanism controls the flow of information; the LSTM layer includes at least two LSTM cells, and the LSTM cells include an input gate, a forget gate, and an output gate, and have candidate memory cell states, memory cell updates, and hidden state updates; The output layer is a fully connected layer that outputs the predicted value. The activation function of the output layer selects a linear activation function.

9. The method for reverse tracing of water pollution sources according to claim 8, characterized in that: in, The LSTM unit input gate is used to control the inflow of new information and is expressed as follows: i t =σ(W i ·[h t-1 ,x t ]+b i ) Where: i t is the activation value of the input gate, which is a value between 0 and 1, controlling the extent to which new input information flows into the memory unit; σ is the activation function, which compresses the input value to between 0 and 1; W i is the weight matrix of the input gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the input gate; h t-1 is the hidden state of the previous time step; x t is the input data of the current time step; b i is the bias term of the input gate; Among them, the forget gate of the LSTM unit is used to control the information in the forgotten memory unit, which is expressed by the following formula: f t =σ(W f ·[h t-1 ,x t ]+b f ) Among them, f t is the activation value of the forget gate, which is a value between 0 and 1, and controls the extent to which the information in the memory unit at the previous moment is retained or forgotten; W f is the weight matrix of the forget gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the forget gate; b f is the bias term of the forget gate; Among them, the output gate of the LSTM unit is used to control the output information, which is expressed by the following formula: the t =σ(W o ·[h t-1 ,x t ]+b o ) Among them, t is the activation value of the output gate, which is a value between 0 and 1, and controls the degree to which the information in the memory unit is output to the hidden state; W o is the weight matrix of the output gate, which is used to transform the previous hidden state h t-1 and the current input x t Mapped to the output gate; b o is the bias term of the output gate; Among them, the candidate memory cell state of the LSTM unit is expressed by the following formula: in, is the candidate memory cell state, which represents the potential memory state after updating based on the current input and the hidden state of the previous time step; tanh is the hyperbolic tangent activation function, which compresses the value to between -1 and 1; W C is the weight matrix of the candidate memory unit state; b C is the bias term of the candidate memory cell state; Among them, the memory unit update of the LSTM unit is expressed by the following formula: Among them, C t is the state of the memory unit at the current time step, which combines the results of the forget gate and the input gate to represent the complete memory at the current moment; C t-1 is the memory cell state of the previous time step; * indicates element multiplication; Among them, the hidden state update of the LSTM unit is expressed as follows: h t =o t *tanh(C t ) Among them, h t is the hidden state of the current time step, calculated based on the output gate and memory cell state; tanh(C t ) is a nonlinear transformation of the memory cell state, which is used to adjust the output amplitude.

10. The method for reverse tracing of water pollution sources according to claim 9, characterized in that: The method of using the data in the database to train the machine learning model comprises the following steps: The training data will be processed into time series form; Divide the dataset into training, validation and test sets; After the LSTM model is constructed, the model is trained and the mean square error (MSE) is selected as the loss function to measure the error between the model prediction value and the actual value, which is expressed by the following formula: Among them, y true,i is the actual value, y pred,i is the predicted value and n is the number of samples. The back propagation algorithm and gradient descent optimizer are used to update the model parameters. The gradient descent optimizer is expressed by the following formula: m t =β1m t-1 +(1-β1)g t v t =β2v t-1 +(1-β2)g t 2 Among them, θ t is the value of the model parameter at time step t; g t is the current gradient calculated at time step t; m t is the first-order moment estimate; v t is the second-order moment estimate; is the bias correction value of the first-order moment estimate; is the bias correction value of the second-order moment estimate; α is the learning rate; β1 is the exponentially weighted decay rate for controlling the first-order moment estimate; β2 is the exponentially weighted decay rate for controlling the second-order moment estimate; ∈ is a small constant added to prevent division by zero.

Citation Information

Patent Citations

  • Basin pollutant flux prediction method based on LSTM-BP space-time combination model

    CN111639748A

  • River pollutant flux intelligent calculation and prediction method based on integrated neural network

    CN112906936A

  • Method and system for predicting drift and diffusion of pollutants in estuary area

    CN114676880A

  • Water quality prediction model migration condition selection method based on XGBoost model

    CN116128049A

  • River pollution tracing method

    CN117391463A

Cited By

  • Underground water pollution source analysis method based on various tracers and electronic equipment

    CN119438003A

  • Drainage basin pollution monitoring method based on drainage basin non-point source pollution monitoring model

    CN119918814A

  • Intelligent processing method and system for radiator salt spray test data

    CN120183568A

  • An intelligent processing method and system for radiator salt spray test data

    CN120183568B

  • Water quality detection system for hydraulic engineering and monitoring method

    CN120214252A