A water quality spatio-temporal prediction method and system coupling LSTM and diffusion models
By combining LSTM and diffusion model, a space-time prediction model for water quality is constructed, which solves the time and space shortcomings of water quality prediction in the existing technology, and realizes accurate space-time prediction of water quality indicators, supporting water environment monitoring and pollution warning.
Patent Information
- Application Number
- CN202411243113.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2044-09-05
AI Technical Summary
The prediction accuracy of existing water quality prediction methods in time and space is insufficient, the mechanism model parameters are difficult to obtain and the prediction accuracy is low, and the data-driven method cannot perform spatial deduction of water quality.
Combining the temporal prediction performance of the LSTM model and the spatial prediction capability of the diffusion model, by collecting water quality monitoring data and related data, performing pretreatment, the water quality index is trained using the LSTM model, and input the diffusion model solution coefficients to construct a water quality spatio-temporal prediction model.
It realizes accurate prediction of water quality indicators in time and space, can quickly identify water quality abnormalities in any section of the river, and supports water environment monitoring and pollution warning.
Smart Images

Figure CN119227870B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water quality prediction, and particularly to a water quality spatio-temporal prediction method and system coupling an LSTM and a diffusion model. Background Art
[0002] The statements in this part merely provide background technical information related to the present invention and do not necessarily constitute prior art.
[0003] Water quality is a multi-faceted concept encompassing a range of biological, chemical, and physical characteristics. It is an important part of the water environment system and a direct indicator of the overall health of the water environment. With the intensification of global climate change and human intervention, water quality deterioration has reached an alarming level, posing a huge threat to the sustainable development of water resources. Water quality problems such as industrial wastewater discharge and eutrophication have brought major challenges to water environment management. It is estimated that approximately 80% of industrial and urban wastewater globally is directly discharged into the environment without proper treatment, causing serious harmful effects on human health and the ecosystem. However, the availability of water quality data remains limited, especially globally, mainly due to insufficient monitoring and reporting capabilities. Therefore, the development of accurate and efficient water quality monitoring and prediction tools has become an important concern in the field of environmental management.
[0004] Currently existing water quality prediction methods mainly include mechanism models relying on physical processes and mathematical statistical models or machine learning models based on a data-driven approach. However, both of these two types of methods have certain limitations. Mechanism models are difficult to model and have low prediction accuracy due to numerous parameters that are difficult to obtain; prediction methods based on a data-driven approach mainly construct models based on historical water quality monitoring data at cross-sections. Therefore, their prediction work is basically carried out at discrete cross-sections and cannot perform spatial deduction of water quality prediction. Summary of the Invention
[0005] To solve the above problems, the present invention proposes a water quality spatio-temporal prediction method and system coupling an LSTM and a diffusion model, effectively coupling the LSTM and the diffusion model, and making full use of the prediction performance of the LSTM model on the time scale and the prediction ability of the diffusion model in space, capable of performing spatio-temporal prediction on the water quality of the target river.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a water quality spatio-temporal prediction method coupling an LSTM and a diffusion model, including the following steps:
[0008] Collect monitoring data at each water quality monitoring cross-section and other data related to water quality spatio-temporal prediction, and perform preprocessing;
[0009] Analyze the collected data to obtain the driving factors of each water quality index;
[0010] Input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality indexes at each water quality monitoring section;
[0011] Input the water quality indexes at each section into the diffusion model to solve the coefficients of the diffusion model;
[0012] Construct a water quality prediction model based on the coefficients of the diffusion model to perform spatio-temporal prediction of water quality.
[0013] As an alternative implementation, other data related to spatio-temporal prediction of water quality include meteorological data, land use data, population data, and hydrological data of hydrological stations in the area where the section is located.
[0014] As an alternative implementation, use Spearman correlation analysis method to analyze the collected data, and extract variables with high correlation with water quality indexes as the driving factors of each water quality index.
[0015] As an alternative implementation, the diffusion model is a one-dimensional water quality model, and the one-dimensional water quality model includes a one-dimensional hydrodynamic mathematical model, a water temperature mathematical model, and a water quality mathematical model.
[0016] As an alternative implementation, the analytical methods for solving the coefficients of the diffusion model include continuous steady discharge and finite-time discharge. Among them, the analytical process of continuous steady discharge selects the corresponding analytical solution formula by judging the O'Connor number α and the Peclet number Pe.
[0017] As an alternative implementation, for finite-time discharge, the bisection method is used to solve the coefficients;
[0018] For continuous steady discharge, two sections are used as the upstream and downstream concentrations, and the coefficients are solved by substituting the distance between the sections.
[0019] In a second aspect, the present invention provides a spatio-temporal water quality prediction system coupling an LSTM and a diffusion model, including:
[0020] A data acquisition module, configured to: collect the monitoring data at each water quality monitoring section and other data related to spatio-temporal prediction of water quality, and perform preprocessing;
[0021] A data analysis module, configured to: analyze the collected data to obtain the driving factors of each water quality index;
[0022] A water quality index prediction module, configured to: input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality indexes at each water quality monitoring section;
[0023] A model parsing module, configured to: input water quality indicators on each cross-section into a diffusion model and solve the coefficients of the diffusion model;
[0024] A result output module, configured to: construct a water quality prediction model based on the coefficients of the diffusion model and perform spatio-temporal prediction on the water quality.
[0025] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and computer instructions stored on the memory and running on the processor. When the computer instructions are run by the processor, the method described in the first aspect is completed.
[0026] In a fourth aspect, the present invention provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the method described in the first aspect is completed.
[0027] In a fifth aspect, the present invention provides a computer program product, including a computer program. When the computer program is executed by a processor, the method described in the first aspect is implemented.
[0028] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0029] The present invention proposes a spatio-temporal water quality prediction method and system coupling an LSTM and a diffusion model. By utilizing the prediction performance of the LSTM model on the time scale and the prediction ability of the diffusion model in space, the two models are effectively coupled to construct a spatio-temporal water quality prediction model. The prediction on the time scale is at the daily scale, and in space, it can cover any position of the river. The spatio-temporal prediction of water quality indicators is realized, thereby achieving the spatio-temporal prediction of water quality indicators of the target river. Compared with the traditional prediction method based on data-driven at discrete cross-sections, the spatio-temporal deduction of discrete cross-section water quality indicator prediction can be realized, which helps to quickly and effectively identify water quality anomalies in any river section. It provides effective data and technical support for management work such as water environment monitoring and supervision, water pollution prediction and early warning, and pollution source tracing.
[0030] The advantages of additional aspects of the present invention will be partially given in the following description, partially become obvious from the following description, or be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings forming a part of this specification are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention.
[0032] Figure 1 is the flow chart of the spatio-temporal water quality prediction method coupling an LSTM and a diffusion model provided in Embodiment 1 of the present invention Figure 1 ;
[0033] Figure 2 This is the process of the water quality spatio-temporal prediction method that couples LSTM and diffusion models provided in Embodiment 1 of the present invention Figure 2 。 Detailed implementation manners
[0034] The present invention will be further described below in conjunction with the accompanying drawings and embodiments
[0035] It should be noted that the following detailed description is exemplary and is intended to provide further illustration of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs
[0036] It should be noted that the terms used herein are only for describing specific implementation manners and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular forms are also intended to include the plural forms. In addition, it should be understood that the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices
[0037] In the case of no conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other
[0038] Embodiment 1
[0039] As Figure 1-2 shown, this embodiment provides a water quality spatio-temporal prediction method that couples LSTM and diffusion models, including the following steps:
[0040] S1 Collect the monitoring data of each water quality monitoring section and other data related to water quality spatio-temporal prediction, and perform preprocessing
[0041] S2 Analyze the collected data to obtain the driving factors of each water quality index
[0042] S3 Input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality indexes of each water quality monitoring section
[0043] S4 Input the water quality indexes of each section into the diffusion model, and solve the coefficients of the diffusion model
[0044] S5 Based on the coefficients of the diffusion model, construct a water quality prediction model to perform spatio-temporal prediction on water quality
[0045] Other data related to the spatio-temporal prediction of water quality include meteorological data, land use data, population data, and hydrological data of hydrological stations in the area where the cross-section is located. The present disclosure first collects daily-scale monitoring data of multiple water quality monitoring cross-sections of a certain river (including indicators such as pH, total nitrogen, total phosphorus, dissolved oxygen, conductivity, ammonia nitrogen, turbidity, permanganate index, water temperature, etc.); meteorological data (including air temperature, precipitation, evaporation, etc.), land use data, population data, and hydrological data of hydrological stations (including flow, water level, etc.) in the area where each cross-section is located, and preprocesses the data through methods such as interpolation, missing value filling, and normalization.
[0046] Use the Spearman correlation analysis method to analyze the collected data, extract variables with high correlation with the prediction indicators (i.e., water quality indicators) as the driving factors and LSTM model input features of each water quality indicator, convert the time series data into a supervised learning method, divide the data into a training set and a test set according to 7:3, construct a water quality prediction model on the time scale at each cross-section and train it. The LSTM model is built using the Keras library in Python, setting the LSTM layer, RepeatVector layer, TimeDistributed layer, etc., and setting the activation function, optimizer, and loss function. Set parameters such as the epochs and batch_size for training the LSTM model.
[0047] The diffusion model is a one-dimensional water quality model, and the one-dimensional water quality model includes a one-dimensional hydrodynamic mathematical model, a water temperature mathematical model, and a water quality mathematical model.
[0048] The basic equation of the hydrodynamic mathematical model is:
[0049]
[0050] Among them, Q is the cross-section flow, q is the lateral inflow per unit river length, A is the cross-section area, Z is the cross-section water level, n is the channel roughness, h is the cross-section water depth, g is the acceleration due to gravity, x is the coordinate in the X direction of the Cartesian coordinate system, and t is the time.
[0051] The basic equation of the water temperature mathematical model is:
[0052]
[0053] Among them, T is the water temperature, E tx is the longitudinal diffusion coefficient of water temperature, T L is the water temperature of the lateral inflow and outflow, ρ is the density, C p is the specific heat of water, S is the net heat exchange flux of the surface area, u is the cross-section flow velocity, and B is the water surface width.
[0054] The basic equation of the water quality mathematical model is:
[0055]
[0056] Among them, E x is the longitudinal diffusion coefficient of pollutants, C L is the pollutant concentration of the lateral inflow and outflow, C is the pollutant concentration, and f(C) is the biochemical reaction term.
[0057] The present disclosure solves the coefficients of the diffusion model, and the analytical methods used are continuous stable emission and finite-time emission. Among them, for continuous stable emission, two cross-sections are used as the upstream and downstream concentrations, and the distance between the cross-sections is substituted to solve the coefficients. According to the simplification of the one-dimensional longitudinal water quality model equation of the river, the analytical formula is selected based on the classification discrimination conditions (i.e., the critical values of the O'Connor number α and the Peclet number Pe). Under different determination conditions, the convective degradation model, the simplified convective-diffusion degradation model, the convective-diffusion degradation model, and the diffusion degradation model are respectively applicable. Among them, the calculation formulas for the critical values of the O'Connor number α and the Peclet number Pe are as follows:
[0058]
[0059] Among them, k is the comprehensive attenuation coefficient of pollutants, with the unit s -1 ; E x is the longitudinal diffusion coefficient of pollutants, with the unit m 2 / s; u is the flow velocity, with the unit m / s; B is the water surface width, with the unit m.
[0060] When α ≤ 0.027 and Pe ≥ 1, the convective degradation model is applicable:
[0061]
[0062] When α ≤ 0.027 and Pe < 1, the simplified convective-diffusion degradation model is applicable:
[0063]
[0064] C0 = (C p Q p + C h Q h ) / (Q p + Q h )
[0065] When 0.027 < α ≤ 380, the convective-diffusion degradation model is applicable:
[0066]
[0067] When α > 380, the diffusion degradation model is applicable:
[0068]
[0069] Among them, α is the O'Connor number, dimensionless, representing the ratio of the discrete degradation flux to the advection flux of the substance. Pe is the Péclet number, dimensionless, representing the ratio of the advection flux to the discrete flux of the substance. C0 is the mixed concentration at the initial section of the river discharge outlet, with the unit of mg / L. x is the longitudinal coordinate of the river, with the unit of m. x = 0 refers to the discharge outlet, x > 0 refers to the downstream section of the discharge outlet, and x < 0 refers to the upstream section of the discharge outlet. Q p is the sewage discharge, m 3 / s, C p is the pollutant discharge concentration, mg / L, Q h is the river flow rate, m 3 / s.
[0070] Take the water quality prediction results of two water quality sections as the upstream and downstream concentrations in the one-dimensional water quality model respectively. Determine the distance information through the longitude and latitude coordinates of the sections, and then solve each coefficient in the analytical formula.
[0071] For finite-time discharge, the bisection method is used to solve the coefficients. The formula during the discharge duration (0 < t j ≤ t0) is as follows:
[0072]
[0073] After the discharge stops (t j > t0), the formula is as follows:
[0074]
[0075] Among them, C(x, t j ) is the pollutant concentration at a distance x from the discharge outlet at time t j , with the unit of mg / L. t0 represents the discharge duration of the pollution source, with the unit of s. n represents the number of calculation segments, n = t0 / Δt. t i-0.5 represents the time variable of the pollution source discharge, t i-0.5 = (i - 0.5)Δt < t, with the unit of s. i is a natural number with a maximum of n. j is a natural number. W i represents the discharge mass of pollutants per unit time during the time period from t i-1 to t i , with the unit of g / s
[0076] Based on each coefficient solved above, establish the analytical formula for various scenarios of the one-dimensional water quality model, so as to solve the concentrations of water quality indicators at different positions. Since the predicted value of LSTM is on a daily scale, the output result of the corresponding one-dimensional water quality model is also on a daily scale in time, so the spatio-temporal prediction of water quality indicators can be realized.
[0077] Example 2
[0078] This embodiment provides a water quality spatio-temporal prediction system that couples an LSTM and a diffusion model, including:
[0079] A data acquisition module, configured to: collect monitoring data on each water quality monitoring section and other data related to water quality spatio-temporal prediction, and perform preprocessing;
[0080] A data analysis module, configured to: analyze the collected data to obtain the driving factors of each water quality index;
[0081] A water quality index prediction module, configured to: input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality indexes on each water quality monitoring section;
[0082] A model analysis module, configured to: input the water quality indexes on each section into the diffusion model to solve the coefficients of the diffusion model;
[0083] A result output module, configured to: construct a water quality prediction model based on the coefficients of the diffusion model to perform spatio-temporal prediction of water quality.
[0084] It should be noted here that the above modules correspond to the steps described in Embodiment 1, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in the above Embodiment 1. It should be noted that the above modules, as part of the system, can be executed in a computer system such as a set of computer-executable instructions.
[0085] In more embodiments, there is also provided:
[0086] An electronic device, including a memory and a processor, and computer instructions stored on the memory and running on the processor. When the computer instructions are run by the processor, the method described in Embodiment 1 is completed. For the sake of brevity, it will not be elaborated here.
[0087] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0088] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A part of the memory may also include a non-volatile random memory. For example, the memory may also store information about the device type.
[0089] A computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the method described in Embodiment 1.
[0090] The method in Embodiment 1 can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.
[0091] A computer program product includes a computer program, which, when executed by a processor, implements the method described in Embodiment 1.
[0092] The present invention also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer-executable instructions, such as instructions included in program modules, which are executed in a device on a target real or virtual processor to perform the process / method as described above. Generally, program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform specific tasks or implement specific abstract data types. In various embodiments, the functions of program modules can be combined or divided as needed. The machine-executable instructions for program modules can be executed locally or within a distributed device. In a distributed device, program modules can be located in local and remote storage media.
[0093] The computer program code for implementing the method of the present invention can be written in one or more programming languages. These computer program codes can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing devices, such that when the program codes are executed by the computer or other programmable data processing devices, the functions / operations specified in the flowchart and / or block diagram are implemented. The program codes can be executed entirely on the computer, partially on the computer, as an independent software package, partially on the computer and partially on a remote computer, or entirely on a remote computer or server.
[0094] In the context of the present invention, the computer program code or related data can be carried by any suitable carrier so that the device, apparatus, or processor can perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, etc. Examples of signals can include electrical, optical, radio, acoustic, or other forms of propagated signals, such as carrier waves, infrared signals, etc.
[0095] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with this embodiment can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0096] Although the specific implementation manners of the present invention have been described above in conjunction with the accompanying drawings, they do not limit the protection scope of the present invention. Those skilled in the art should understand that based on the technical solution of the present invention, various modifications or deformations that can be made by those skilled in the art without creative efforts are still within the protection scope of the present invention.
Claims
1. A water quality spatio-temporal prediction method coupling LSTM and diffusion model, characterized in that It includes the following steps: Collect the monitoring data at each water quality monitoring section and other data related to the spatio-temporal prediction of water quality, and perform preprocessing; Analyze the collected data to obtain the driving factors of each water quality index; Input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality indexes at each water quality monitoring section; Input the water quality indexes at each section into the diffusion model to solve the coefficients of the diffusion model; The analytical methods for solving the coefficients of the diffusion model include continuous steady discharge and finite-time discharge. For continuous steady discharge, take the water quality prediction results of two sections as the upstream and downstream concentrations, and substitute the distance between the sections to solve the coefficients. Among them, the analytical process of continuous steady discharge selects the corresponding analytical model by judging the O'Connor number α and the Peclet number Pe; Under different judgment conditions, the convective degradation model, the simplified convective-diffusive degradation model, the convective-diffusive degradation model, and the diffusive degradation model are respectively applied; Construct a water quality prediction model based on the coefficients of the diffusion model to perform spatio-temporal prediction of water quality.
2. The water quality spatio-temporal prediction method coupling LSTM and diffusion model according to claim 1, characterized in that, Other data related to the spatio-temporal prediction of water quality include meteorological data, land use data, population data, and hydrological data of hydrological stations in the area where the section is located.
3. The water quality spatio-temporal prediction method coupling LSTM and diffusion model according to claim 1, characterized in that, Use the Spearman correlation analysis method to analyze the collected data, and extract the variables with high correlation with the water quality indexes as the driving factors of each water quality index.
4. The water quality spatio-temporal prediction method coupling LSTM and diffusion model according to claim 1, wherein, The diffusion model is a one-dimensional water quality model, and the one-dimensional water quality model includes a one-dimensional hydrodynamic mathematical model, a water temperature mathematical model, and a water quality mathematical model.
5. The water quality spatio-temporal prediction method coupling LSTM and diffusion model according to claim 1, characterized in that, For finite-time discharge, the bisection method is used to solve the coefficients.
6. A water quality spatio-temporal prediction system coupling LSTM and diffusion models, characterized in that, It includes: A data collection module configured to: collect the monitoring data at each water quality monitoring section and other data related to the spatio-temporal prediction of water quality, and perform preprocessing; A data analysis module configured to: analyze the collected data to obtain the driving factors of each water quality index; A water quality index prediction module configured to: input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality indexes at each water quality monitoring section; A model analysis module configured to: input the water quality indexes at each section into the diffusion model to solve the coefficients of the diffusion model; The analytical methods for solving the coefficients of the diffusion model include continuous steady discharge and finite-time discharge. For continuous steady discharge, take the water quality prediction results of two sections as the upstream and downstream concentrations, and substitute the distance between the sections to solve the coefficients. Among them, the analytical process of continuous steady discharge selects the corresponding analytical model by judging the O'Connor number α and the Peclet number Pe; Under different judgment conditions, the convective degradation model, the simplified convective-diffusive degradation model, the convective-diffusive degradation model, and the diffusive degradation model are respectively applied; A result output module configured to: construct a water quality prediction model based on the coefficients of the diffusion model to perform spatio-temporal prediction of water quality.
7. An electronic device, characterized in that, It includes a memory, a processor, and computer instructions stored on the memory and running on the processor. When the computer instructions are run by the processor, the method according to any one of claims 1-5 is completed.
8. A computer-readable storage medium, characterized in that, For storing computer instructions, when the computer instructions are executed by a processor, the method according to any one of claims 1-5 is completed.
9. A computer program product, characterized in that, Comprising a computer program, when the computer program is executed by a processor, the method according to any one of claims 1-5 is implemented.
Citation Information
Patent Citations
Water quality prediction method and system based on coupled Kalman filtering data assimilation
CN117192063A
Method and device for calculating contribution degree of discharge port pollutant into river section and medium
CN117371325A