Method and device for predicting hydrogen sulfide in urban sewage pipes based on WATS-LSTM coupling model
Through the WATS-LSTM coupling model, combined with sewage pipe characteristics and water quality parameters, the accuracy and generalization problems of hydrogen sulfide generation prediction in sewage pipes were solved, achieving more accurate prediction and real-time monitoring, and reducing economic costs.
Patent Information
- Application Number
- CN202310292007.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-23
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2043-03-23
AI Technical Summary
The existing technology for predicting hydrogen sulfide generation in sewage pipes has the problem that the mechanism model assumptions ignore the interference of physical, chemical and biological factors, resulting in increased deviation, poor interpretability of data-driven models and poor generalization ability.
The WATS-LSTM coupling model is adopted, combined with the characteristic parameters of sewage pipes and water quality parameters. Through WATS model construction and parameter calibration, optimized by simulated annealing algorithm, combined with LSTM model training and factor analysis, accurate prediction of hydrogen sulfide emissions is achieved.
It improves the prediction accuracy of hydrogen sulfide generation and emission, captures the nonlinear and dynamic relationship of sewage pipe systems, has good generalization ability, and supports real-time monitoring and economic cost reduction.
Smart Images

Figure CN116306299B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of urban environmental pollution control, and in particular to a method and device for predicting hydrogen sulfide in an urban sewage pipe based on a WATS-LSTM coupling model. Background Art
[0002] In urban sewage systems, wastewater contains a large amount of nutrients, bacteria, and organic matter. During the process of transporting wastewater to sewage treatment plants, the biomass in the wastewater forms a biofilm on the sewer walls, consuming oxygen and causing the pipes to become anaerobic. This converts sulfate into sulfide, which is then converted into hydrogen sulfide gas. Released into the sewer atmosphere, this gas causes odor and corrosion, imposing significant economic costs on infrastructure maintenance. Therefore, accurately predicting the process and trends of hydrogen sulfide generation and emission in urban sewage pipes is crucial for sewage pipe management and environmental monitoring.
[0003] Extensive research has been conducted both domestically and internationally on the prediction of hydrogen sulfide in sewage pipelines. Internationally, research has primarily focused on developing new prediction methods and technologies, such as computational fluid dynamics models, artificial neural networks, machine learning, and mathematical modeling. In China, however, the emphasis has been on the formation mechanisms and control methods of hydrogen sulfide, such as microbial regulation, waste gas treatment technologies, and chemical additives. However, while mechanistic models can be applied in various scenarios, some of their assumptions ignore the physical, chemical, and biological factors that interfere with actual sewage pipelines, leading to increased bias and limited applicability. Furthermore, while data-driven models can learn hidden patterns and features from large-scale, high-dimensional, and complex data without requiring prior knowledge or assumptions, they also suffer from poor interpretability and generalization. Therefore, there is a need to combine the strengths of both mechanistic and data-driven models to develop a method that can describe the hydrogen sulfide formation process and accurately predict the amount of hydrogen sulfide produced. Summary of the Invention
[0004] In response to the above problems, the present invention provides a method and device for predicting hydrogen sulfide in urban sewage pipes based on a WATS-LSTM coupling model. The method is based on the WATS model and the LSTM model to perform data acquisition, processing and analysis, and is used to model and predict the complex process of hydrogen sulfide generation and emission in urban sewage pipes, in order to at least partially solve the above technical problems.
[0005] A first aspect of the present invention provides a method for predicting hydrogen sulfide in urban sewage pipes based on a WATS-LSTM coupling model, the method comprising the following steps:
[0006] Obtain characteristic parameters of the sewage pipe and collect data on hydrogen sulfide emissions, flow rates, and water quality parameters at each monitoring point on the sewage pipe section;
[0007] A WATS model of the sewage pipeline is constructed using the characteristic parameters of the sewage pipeline and the hydrogen sulfide emission, flow rate and water quality parameter data of each monitoring point, and the parameters of the WATS model are calibrated; the parameters of the WATS model are updated using a simulated annealing algorithm, and the WATS model is verified using actual data;
[0008] The water quality data generated by the verified WATS model and the collected water quality parameter data are used as the dependent variable data matrix and standardized, the number of common factors is determined according to the scree test, and the standardized dependent variable data matrix is subjected to factor analysis, the factor score function coefficients are calculated, and the factor score matrix is obtained by solving the problem;
[0009] Dividing the factor score matrix into a training set and a test set, and using the training set to train the LSTM model after initializing the hyperparameters, wherein the output of the LSTM model is normalized hydrogen sulfide emissions;
[0010] The test set data is input into the trained LSTM model, and the output result of the LSTM model is reverse normalized to obtain the predicted value of hydrogen sulfide emissions.
[0011] A further technical solution of the present invention is: the characteristic parameters of the sewage pipe include one or more of the sewage pipe length, pipe diameter, slope, and fullness; the water quality parameters include one or more of temperature, pH, total chemical oxygen demand, sulfate, dissolved oxygen, nitrate, divalent iron, trivalent iron, and iron sulfide.
[0012] A further technical solution of the present invention is that the sewage pipe WATS model includes one or more of hydraulic, sulfur conversion, precipitation, aeration, electron acceptor conversion and organic matter conversion processes.
[0013] A further technical solution of the present invention is: the verification of the WATS model using actual data specifically includes: 2 The simulation effect of the WATS model is evaluated to determine whether the simulated water quality meets the accuracy requirements. If it meets the requirements, the model calibration is considered to be completed; if it does not meet the requirements, the model is returned to readjust the parameters, where R 2 The expression is:
[0014]
[0015] Among them, y i is the i-th sample value, is the ith simulation value, is the sample mean, and n is the number of samples.
[0016] A further technical solution of the present invention is: the dependent variable data matrix is standardized, and the specific expression is: Among them, x new is the standardized data, x is the sample data, μ is the sample mean, and σ is the sample standard deviation.
[0017] A further technical solution of the present invention is: the determining of the number of common factors based on the scree test specifically includes: determining the number of factors by observing the changes in eigenvalues in the scree plot; when the eigenvalue a drops significantly compared to the value of the previous eigenvalue, and the eigenvalue a is small, and the eigenvalues following the eigenvalue a have a small change amplitude, then several eigenvalues preceding the eigenvalue a are selected as the common factors.
[0018] A further technical solution of the present invention is: performing factor analysis on the standardized dependent variable data matrix, calculating the factor score function coefficients and solving to obtain the factor score matrix, specifically comprising: according to the factor analysis model, expressing the common factors as linear combinations of the original variables, that is, obtaining the factor score matrix, wherein the factor analysis model is: x = u + Af + ε, x = (x1, x2, ..., x p )′ is a random vector of n×p, μ=(μ1,μ2,...,μ p )′ is the mean of x, f=(f1,f2,...,f m )′ is the common factor vector, ε=(ε1,ε2,...,ε m )′ is a special factor vector, A p×m =(a ij) is the factor loading matrix;
[0019] The specific process expression of the factor score matrix obtained is:
[0020]
[0021] Among them, B m×p =(b ij ) is the factor score coefficient matrix.
[0022] A further technical solution of the present invention is: the LSTM model after initializing the hyperparameters is trained using the training set, including calculating the accuracy of the LSTM model. If the model accuracy reaches a threshold, the model training is completed; if the model accuracy does not reach the threshold, the model hyperparameters are updated and the training is continued, wherein the model accuracy is calculated by R 2 , MSE, and MAPE are used to compare the hydrogen sulfide prediction results with the actual values:
[0023]
[0024]
[0025]
[0026] Among them, y i is the i-th sample value, is the i-th predicted value, is the sample value, and n is the number of samples.
[0027] A further technical solution of the present invention is: performing reverse normalization on the output result of the LSTM model to obtain a predicted value of hydrogen sulfide emissions, wherein the reverse normalization expression is:
[0028]
[0029] in, is the amount of hydrogen sulfide emissions, is the model output value, y max is the maximum value of hydrogen sulfide emissions, y min It is the minimum value of hydrogen sulfide emissions.
[0030] A second aspect of the present invention is a device for predicting hydrogen sulfide in urban sewage pipes based on a WATS-LSTM coupling model, the device comprising:
[0031] A data acquisition module is used to obtain characteristic parameters of the sewage pipe and collect hydrogen sulfide emission, flow and water quality parameter data at each monitoring point on the sewage pipe section;
[0032] a WATS model construction module, configured to construct a WATS model of the sewage pipeline using the characteristic parameters of the sewage pipeline and the hydrogen sulfide emission, flow rate, and water quality parameter data of each monitoring point and to calibrate the parameters of the WATS model; to update the parameters of the WATS model using a simulated annealing algorithm and to verify the WATS model using actual data;
[0033] a factor score matrix acquisition module, configured to use the water quality data generated by the verified WATS model and the collected water quality parameter data as a dependent variable data matrix and perform standardization processing, determine the number of common factors according to a scree test, perform factor analysis on the standardized dependent variable data matrix, calculate factor score function coefficients, and solve to obtain a factor score matrix;
[0034] An LSTM model training module is used to divide the factor score matrix into a training set and a test set, and use the training set to train the LSTM model after initializing the hyperparameters, wherein the output of the LSTM model is normalized hydrogen sulfide emissions;
[0035] The prediction module is used to input the test set data into the trained LSTM model and perform reverse normalization on the output result of the LSTM model to obtain a predicted value of hydrogen sulfide emissions.
[0036] The present invention provides a method and device for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model. This method leverages the kinetics of the sewage treatment process and dynamically optimizes model parameters using a heuristic optimization algorithm and a neural network algorithm. This method more accurately predicts the generation of H2S in sewage pipes, provides a better understanding of the operating mechanism of the pipeline system, and facilitates pipeline maintenance and optimized design. Its main benefits include:
[0037] 1. The coupling of the WATS model and the LSTM model can overcome the limitations of a single model and improve prediction accuracy;
[0038] 2. It can capture the nonlinear and dynamic relationships in the sewage pipe system, making the prediction results more accurate;
[0039] 3. Ability to adaptively learn new data patterns, and the prediction model has good generalization ability;
[0040] 4. It can monitor the generation and emission of hydrogen sulfide in sewage pipes in real time, providing a scientific basis for environmental protection and sewage treatment;
[0041] 5. It can help relevant departments formulate effective pipeline maintenance and management strategies to reduce economic costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a flow chart of a method for predicting hydrogen sulfide in urban sewage pipes based on a WATS-LSTM coupling model in Example 1 of the present invention;
[0043] Figure 2 This is an example diagram of a method for predicting hydrogen sulfide in a municipal sewage pipe based on a WATS-LSTM coupling model in Example 1 of the present invention;
[0044] Figure 3 This is a schematic diagram of the structure of a device for predicting hydrogen sulfide in a municipal sewage pipe based on a WATS-LSTM coupling model in Example 2 of the present invention;
[0045] Figure 4 This is a schematic diagram of the structure of a device for predicting hydrogen sulfide in urban sewage pipes based on a WATS-LSTM coupling model in Example 3 of the present invention. DETAILED DESCRIPTION
[0046] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, rather than all structures.
[0047] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0048] The present invention provides a method and device for predicting hydrogen sulfide in urban sewage pipes based on a WATS-LSTM coupling model, and provides the following embodiments:
[0049] Embodiment 1 of the present invention
[0050] This example is used to illustrate the prediction method of hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model. Figure 1 , which is a flow chart of the method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model, specifically including the following steps:
[0051] S110, obtaining characteristic parameters of the sewage pipe, collecting hydrogen sulfide emission, flow rate and water quality parameter data at each monitoring point on the sewage pipe section;
[0052] S120, constructing a sewage pipeline WATS model using the sewage pipeline characteristic parameters and the hydrogen sulfide emission, flow rate, and water quality parameter data of each monitoring point and calibrating the WATS model parameters; updating the WATS model parameters using a simulated annealing algorithm, and verifying the WATS model using actual data;
[0053] S130, using the water quality data generated by the verified WATS model and the collected water quality parameter data as a dependent variable data matrix and performing standardization processing, determining the number of common factors according to a scree test and performing factor analysis on the standardized dependent variable data matrix, calculating the coefficients of the factor score function and solving to obtain a factor score matrix;
[0054] S140, dividing the factor score matrix into a training set and a test set, and using the training set to train the LSTM model after initializing the hyperparameters, wherein the output of the LSTM model is normalized hydrogen sulfide emissions;
[0055] S150: Input the test set data into the trained LSTM model, and perform reverse normalization on the output result of the LSTM model to obtain a predicted value of hydrogen sulfide emissions.
[0056] Specific examples include Figure 2 As shown, during the specific implementation of S110, the sewage pipe characteristic parameters preferably include one or more of sewage pipe length, pipe diameter, slope, and fullness; the water quality parameters preferably include one or more of temperature, pH, total chemical oxygen demand, sulfate, dissolved oxygen, nitrate, ferrous iron, ferric iron, and iron sulfide. The collection interval is once every hour.
[0057] During the specific implementation of S120, the sewage pipe WATS model preferably includes one or more of hydraulic, sulfur conversion, sedimentation, aeration, electron acceptor conversion and organic matter conversion processes.
[0058] Specifically, the sewage pipe system is divided into several sections, and a WATS model is established for each section. The adjacent sections are coupled through the mass and momentum conservation equations, and the model parameters are calibrated according to the parameter value range. The WATS model has a total of 13 water quality components and a total of 15 reaction processes, as shown in Tables 1 and 2:
[0059] Table 1 Description of water quality components in the WATS model
[0060]
[0061] Table 2 Description of the reaction process of WATS model
[0062]
[0063]
[0064] Furthermore, the simulated annealing algorithm (SA) is used to update the model parameters as follows:
[0065] I. Set the initial temperature T = 1000, the temperature drop rate a = 0.95, the maximum number of iterations maxgen = 500, the number of iterations at each temperature LK = 200, and the initial solution x (the default value of WATS parameters);
[0066] II. Perform multiple random perturbations at the current temperature to obtain a new solution x';
[0067] III. Calculate the energy difference ΔE = E(x') - E(x), where E(x) is the simulation determination coefficient of the current solution (i.e., the value of the objective function), and E(x') is the simulation determination coefficient of the new solution;
[0068] IV. Decide whether to accept the new solution based on the probability distribution P(ΔE,T):
[0069]
[0070] V. Lower the temperature to T′=αT and enter the next round of simulated annealing;
[0071] VI. Repeat steps ii-v until the termination condition is met, such as the temperature drops to 0 or the maximum number of iterations is reached.
[0072] Furthermore, the WATS model is verified by using actual data, specifically including: 2 The simulation effect of the WATS model is evaluated to determine whether the simulated water quality meets the accuracy requirements. If it meets the requirements, the model calibration is considered to be completed; if it does not meet the requirements, the model is returned to readjust the parameters, where R 2 The expression is:
[0073]
[0074] Among them, y i is the i-th sample value, is the ith simulation value, is the sample mean, and n is the number of samples.
[0075] The specific implementation process is: the model parameters obtained by the simulated annealing algorithm are brought into the WATS model to obtain the simulated 13 water quality results corresponding to different points, combined with the actual collected data, and the R corresponding to each water quality is calculated. 2 , judge when 13 kinds of water quality R 2 If both are greater than 0.8, the model calibration is considered successful; otherwise, the model will continue to return to readjust the parameters.
[0076] In a preferred embodiment of S130, the collected temperature, pH, and total chemical oxygen demand data are combined with the three water quality data generated by the WATS model in S120 as a dependent variable data matrix, and are standardized: Among them, x new is the standardized data, x is the sample data, μ is the sample mean, and σ is the sample standard deviation.
[0077] Preferably, determining the number of common factors according to the scree test specifically includes: determining the number of factors by observing the changes in eigenvalues in the scree plot; when the eigenvalue a drops significantly compared to the value of the previous eigenvalue, and the eigenvalue a is small, and the eigenvalues following the eigenvalue a have a small change amplitude, then several eigenvalues preceding the eigenvalue a are selected as the number of common factors.
[0078] Specifically, the scree test determines the number of factors by directly observing the changes in eigenvalues through a scree plot. When the m+1 eigenvalue shows a significant decrease compared to the previous eigenvalue, and this eigenvalue is small, and the eigenvalues following it do not change much, adding the factor corresponding to this eigenvalue will only add very little information, so the first m eigenvalues are selected as the number of common factors.
[0079] The standardized data were subjected to factor analysis (FA), and the factor analysis model was as follows:
[0080]
[0081] The matrix form of the above formula is: x=u+Af+ε
[0082] Where x=(x1, x2, ..., x p )′ is a random vector of n×p, μ=(μ1,μ2,...,μ p )′ is the mean of x, f=(f1,f2,...,f m )′ is the common factor vector, ε=(ε1,ε2,...,ε m )′ is a special factor vector, A p×m =(a ij ) is the factor loading matrix.
[0083] Solving the factor score matrix means expressing the common factors as linear combinations of the original variables according to the factor analysis model, that is, obtaining the factor scores:
[0084] Among them, B m×p =(b ij ) is the factor score coefficient matrix.
[0085] During the specific implementation of S140, the factor score matrix obtained in S130 is divided into a training set and a test set. Preferably, the training set and the test set are divided based on the following: the first 75% of the data is used as the training set data, and the last 25% of the data is used as the test set data. The training set data is used as the model input, and the normalized H2S emissions are used as the model output. The initial LSTM hyperparameters are: number of hidden layers: 2 layers; number of LSTM neurons per layer: 32; learning rate: 0.001; batch size: 32; input sequence length: 50; regularization parameter: L1 regularization; optimizer: SGD; activation function: sigmoid. The training set data is brought into the LSTM model training, and according to the LSTM model hyperparameter value settings, a grid search is performed to find the model hyperparameters with good R2, MSE, and MAPE indicators. The LSTM model hyperparameter value settings are detailed in Table 3:
[0086] Table 3 LSTM model hyperparameter value settings
[0087]
[0088] Preferably, the LSTM model after initializing the hyperparameters is trained using the training set, including calculating the accuracy of the LSTM model. If the model accuracy reaches a threshold, the model training is completed; if the model accuracy does not reach the threshold, the model hyperparameters are updated and the training is continued, wherein the model accuracy is calculated by R 2 , MSE, and MAPE are used to compare the hydrogen sulfide prediction results with the actual values:
[0089]
[0090]
[0091]
[0092] Among them, y i is the i-th sample value, is the i-th predicted value, is the sample value, and n is the number of samples.
[0093] Preferably, the output result of the LSTM model is reverse normalized to obtain a predicted value of hydrogen sulfide emissions, and the reverse normalization expression is:
[0094]
[0095] in, is the H2S emission, is the model output value, y max is the maximum value of H2S emission, y min It is the minimum value of hydrogen sulfide emissions.
[0096] Embodiment 2 of the present invention
[0097] A device 300 for predicting hydrogen sulfide in urban sewage pipes based on a WATS-LSTM coupling model provided in Example 2 of the present invention can execute the method for predicting hydrogen sulfide in urban sewage pipes based on a WATS-LSTM coupling model provided in Example 1 of the present invention, and has functional modules and beneficial effects corresponding to the execution method. The device can be implemented by software and / or hardware (integrated circuit) and can generally be integrated into a server or terminal device. Figure 3 Schematic diagram of a hydrogen sulfide prediction device 300 in a municipal sewage pipe based on a WATS-LSTM coupling model in Example 2 of the present invention. Figure 3 The device 300 for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to an embodiment of the present invention may specifically include:
[0098] The data acquisition module 310 is used to obtain characteristic parameters of the sewage pipe and collect hydrogen sulfide emission, flow and water quality parameter data at each monitoring point on the sewage pipe section;
[0099] A WATS model construction module 320 is configured to construct a WATS model of the sewage pipeline using the sewage pipeline characteristic parameters and the hydrogen sulfide emission, flow rate, and water quality parameter data of each monitoring point and to calibrate the WATS model parameters; update the WATS model parameters using a simulated annealing algorithm, and verify the WATS model using actual data;
[0100] A factor score matrix acquisition module 330 is configured to use the water quality data generated by the verified WATS model and the collected water quality parameter data as a dependent variable data matrix and perform standardization processing, determine the number of common factors based on a scree test, perform factor analysis on the standardized dependent variable data matrix, calculate factor score function coefficients, and solve to obtain a factor score matrix;
[0101] An LSTM model training module 340 is configured to divide the factor score matrix into a training set and a test set, and train the LSTM model after initializing hyperparameters using the training set, wherein the output of the LSTM model is normalized hydrogen sulfide emissions;
[0102] The prediction module 350 is used to input the test set data into the trained LSTM model and perform reverse normalization on the output result of the LSTM model to obtain a predicted value of hydrogen sulfide emissions.
[0103] In addition to the above modules, the device 300 for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model may also include other components. However, since these components are irrelevant to the content of the embodiment of the present disclosure, their illustration and description are omitted here.
[0104] The specific working process of the device 300 for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model is described in Example 1 of the method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model, and will not be repeated here.
[0105] Embodiment 3 of the present invention
[0106] The device for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model provided in the third embodiment of the present invention can also execute the method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model provided in the first embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. Figure 4The device for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to an embodiment of the present invention specifically includes:
[0107] Sewage pipes, which can obtain characteristic parameters of the sewage pipes, and collect hydrogen sulfide emissions, flow rates and water quality parameter data at each monitoring point on the sewage pipe section;
[0108] An electronic device configured as a data processing unit and a hydrogen sulfide prediction unit, wherein:
[0109] The data processing unit includes: using the characteristic parameters of the sewage pipe and the hydrogen sulfide emissions, flow and water quality parameter data of each monitoring point to construct a sewage pipe WATS model and calibrate the parameters of the WATS model; using a simulated annealing algorithm to update the WATS model parameters, and using actual data to verify the WATS model; using the water quality data generated by the verified WATS model and the collected water quality parameter data as the dependent variable data matrix and standardizing them, determining the number of common factors according to a gravel test and performing factor analysis on the standardized dependent variable data matrix, calculating the factor score function coefficients and solving them to obtain a factor score matrix; dividing the factor score matrix into a training set and a test set, using the training set to train the LSTM model after initializing the hyperparameters, and the output of the LSTM model is the normalized hydrogen sulfide emissions.
[0110] The hydrogen sulfide prediction unit includes: inputting the test set data into the trained LSTM model, and performing reverse normalization on the output result of the LSTM model to obtain a predicted value of hydrogen sulfide emissions.
[0111] Hydrogen sulfide prediction device in urban sewage pipes based on WATS-LSTM coupling model ( Figure 4 The specific working process of the method (shown) is described in Example 1 of the above-mentioned method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model, and will not be repeated here.
[0112] In summary, it can be seen from the embodiments that the present invention provides a method and device for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model, and its beneficial effects mainly include: based on the coupling of the WATS model and the LSTM model, it can overcome the limitations of a single model and improve the prediction accuracy; it can capture the nonlinear and dynamic relationships in the sewage pipe system, and the prediction results are more accurate; it can adaptively learn new data patterns, and the prediction model has good generalization ability; it can monitor the generation and emission of hydrogen sulfide in sewage pipes in real time, providing a scientific basis for environmental protection and sewage treatment; it can help relevant departments formulate effective pipeline maintenance and management strategies and reduce economic costs.
[0113] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model, characterized in that: The method comprises the following steps: Obtain characteristic parameters of the sewage pipeline and collect hydrogen sulfide emission, flow rate and water quality parameter data at each monitoring point on the sewage pipeline; A WATS model of the sewage pipeline is constructed using the characteristic parameters of the sewage pipeline and the hydrogen sulfide emission, flow rate and water quality parameter data of each monitoring point, and the parameters of the WATS model are calibrated; the parameters of the WATS model are updated using a simulated annealing algorithm, and the WATS model is verified using actual data; The water quality data generated by the verified WATS model and the collected water quality parameter data are used as the dependent variable data matrix and standardized, the number of common factors is determined according to the scree test, and the standardized dependent variable data matrix is subjected to factor analysis, the factor score function coefficients are calculated, and the factor score matrix is obtained by solving the problem; Dividing the factor score matrix into a training set and a test set, and using the training set to train the LSTM model after initializing the hyperparameters, wherein the output of the LSTM model is normalized hydrogen sulfide emissions; The test set data is input into the trained LSTM model, and the output result of the LSTM model is reverse normalized to obtain the predicted value of hydrogen sulfide emissions.
2. The method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to claim 1 is characterized in that: The characteristic parameters of the sewage pipe include one or more of the sewage pipe length, pipe diameter, slope, and fullness; the water quality parameters include one or more of temperature, pH, total chemical oxygen demand, sulfate, dissolved oxygen, nitrate, divalent iron, trivalent iron, and iron sulfide.
3. The method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to claim 1 is characterized in that: The sewage pipe WATS model includes one or more of hydraulic, sulfur conversion, sedimentation, aeration, electron acceptor conversion and organic matter conversion processes.
4. The method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to claim 1 is characterized in that: The verification of the WATS model using actual data specifically includes: 2 The simulation effect of the WATS model is evaluated to determine whether the simulated water quality meets the accuracy requirements. If it meets the requirements, the model calibration is considered to be completed; if it does not meet the requirements, the model is returned to readjust the parameters, where R 2 The expression is: Among them, y i is the i-th sample value, is the i-th predicted value, is the sample mean, and n is the number of samples.
5. The method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to claim 1 is characterized in that: The dependent variable data matrix is standardized, and the specific expression is: Among them, x new is the standardized data, x is the sample data, μ is the sample mean, and σ is the sample standard deviation.
6. The method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to claim 1 is characterized in that: The method of determining the number of common factors according to the scree test specifically includes: determining the number of factors by observing the changes in eigenvalues in the scree plot; when the eigenvalue a decreases significantly compared to the value of the previous eigenvalue, and the eigenvalue a is small, and the changes in the eigenvalues after the eigenvalue a are small, then several eigenvalues before the eigenvalue a are selected as the common factors.
7. The method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to claim 1 is characterized in that: The LSTM model after initializing the hyperparameters is trained using the training set, including calculating the accuracy of the LSTM model. If the model accuracy reaches a threshold, the model training is completed; if the model accuracy does not reach the threshold, the model hyperparameters are updated and the training is continued. The model accuracy is calculated by R 2 , MSE, and MAPE are used to compare the hydrogen sulfide prediction results with the actual values: Among them, y i is the i-th sample value, is the i-th predicted value, is the sample mean, and n is the number of samples.
8. The method for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model according to claim 1 is characterized in that: The output result of the LSTM model is reverse normalized to obtain the predicted value of hydrogen sulfide emissions. The reverse normalization expression is: in, is the amount of hydrogen sulfide emissions, is the model output value, y max is the maximum value of hydrogen sulfide emissions, y min It is the minimum value of hydrogen sulfide emissions.
9. A device for predicting hydrogen sulfide in urban sewage pipes based on the WATS-LSTM coupling model, characterized in that: The device comprises: A data acquisition module is used to obtain characteristic parameters of the sewage pipeline and collect hydrogen sulfide emission, flow and water quality parameter data at each monitoring point on the sewage pipeline; a WATS model construction module, configured to construct a WATS model of the sewage pipeline using the characteristic parameters of the sewage pipeline and the hydrogen sulfide emission, flow rate, and water quality parameter data of each monitoring point and to calibrate the parameters of the WATS model; to update the parameters of the WATS model using a simulated annealing algorithm and to verify the WATS model using actual data; a factor score matrix acquisition module, configured to use the water quality data generated by the verified WATS model and the collected water quality parameter data as a dependent variable data matrix and perform standardization processing, determine the number of common factors according to a scree test, perform factor analysis on the standardized dependent variable data matrix, calculate factor score function coefficients, and solve to obtain a factor score matrix; An LSTM model training module is used to divide the factor score matrix into a training set and a test set, and use the training set to train the LSTM model after initializing the hyperparameters, wherein the output of the LSTM model is normalized hydrogen sulfide emissions; The prediction module is used to input the test set data into the trained LSTM model and perform reverse normalization on the output result of the LSTM model to obtain a predicted value of hydrogen sulfide emissions.