Water quality space-time prediction method and system coupled with LSTM (Long Short Term Memory) and diffusion model
By coupling LSTM and diffusion model, a space-time water quality prediction model is constructed, which solves the problems of difficulty in obtaining parameters and low prediction accuracy in the existing technology, realizes the prediction of water quality in time and space, and improves the efficiency and accuracy of water environment management.
Patent Information
- Application Number
- CN202411243113.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-09-05
AI Technical Summary
The existing water quality prediction methods are difficult to obtain parameters, low prediction accuracy and inability to perform spatial deduction, especially the limited availability of water quality data on a global scale, which leads to huge challenges in water environment management.
Using the water quality spatiotemporal prediction method coupled to LSTM and diffusion model, the prediction performance of the LSTM model on the time scale and the prediction ability of the diffusion model in the space are constructed, and the driving factor analysis is used to solve diffusion. Model coefficients realize spatial and temporal prediction of water quality.
The prediction of water quality indicators on both time and space scales is achieved, and the water quality abnormalities in any section of the river can be quickly identified, and effective water environment monitoring and pollution warning support is provided, which improves the efficiency of water quality monitoring and management.
Smart Images

Figure CN119227870A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water quality prediction, and in particular to a method and system for spatiotemporal prediction of water quality by coupling LSTM and diffusion model. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Water quality is a multifaceted concept that covers a range of biological, chemical and physical properties. It is an important component 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 has deteriorated to an alarming degree, posing a huge threat to the sustainable development of water resources. Water quality issues such as industrial wastewater discharge and eutrophication have brought major challenges to water environment management. It is estimated that about 80% of industrial and municipal wastewater worldwide is directly discharged into the environment without proper treatment, causing serious harmful effects on human health and ecosystems. However, the availability of water quality data remains limited, especially on a global scale, 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] The existing water quality prediction methods mainly include those that rely on mechanism models based on physical processes and mathematical statistical models or machine learning models based on data-driven methods. However, both methods have certain limitations. The mechanism models have many parameters and are difficult to obtain, which makes modeling difficult and the prediction accuracy low. The data-driven prediction method mainly builds models based on historical water quality monitoring data of sections. Therefore, its prediction work is basically carried out on discrete sections, and it is impossible to perform spatial deduction of water quality prediction. Summary of the invention
[0005] In order to solve the above problems, the present invention proposes a water quality spatiotemporal prediction method and system that couples LSTM and diffusion model, which effectively couples LSTM and diffusion model, fully utilizes the prediction performance of LSTM model on time scale and the prediction ability of diffusion model on space, and can perform spatiotemporal prediction of water quality of target rivers.
[0006] In order to achieve the above object, the present invention adopts the following technical solution:
[0007] In a first aspect, the present invention provides a water quality spatiotemporal prediction method coupling LSTM and diffusion model, comprising the following steps:
[0008] Collect monitoring data from each water quality monitoring section and other data related to water quality spatiotemporal prediction, and perform preprocessing;
[0009] Analyze the collected data to obtain the driving factors of each water quality indicator;
[0010] The driving factors are input into the LSTM model, and the LSTM model is trained to obtain water quality indicators at each water quality monitoring section;
[0011] Input the water quality indexes at each section into the diffusion model and solve the coefficients of the diffusion model;
[0012] A water quality prediction model is constructed based on the coefficients of the diffusion model to make spatiotemporal predictions of water quality.
[0013] As an optional implementation, other data related to the spatiotemporal prediction of water quality include meteorological data, land use data, population data and hydrological data of the hydrological station in the area where the section is located.
[0014] As an optional implementation, the collected data is analyzed using the Spearman correlation analysis method to extract variables with high correlation with water quality indicators as driving factors for each water quality indicator.
[0015] As an optional 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 optional implementation, the analytical method for solving the coefficients of the diffusion model includes two methods: continuous stable emission and finite period emission. The analytical process of continuous stable emission selects the corresponding analytical solution formula by judging the O'Connor number α and the Beckley number Pe.
[0017] As an optional implementation, the coefficients are solved using a binary method for finite-time emission;
[0018] For continuous and stable discharge, the two sections are taken 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 water quality spatiotemporal prediction system coupling LSTM and diffusion model, comprising:
[0020] The data acquisition module is configured to: collect monitoring data on each water quality monitoring section and other data related to water quality spatiotemporal prediction, and perform preprocessing;
[0021] The data analysis module is configured to: analyze the collected data to obtain the driving factors of each water quality indicator;
[0022] The water quality index prediction module is configured to: input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality index on each water quality monitoring section;
[0023] The model analysis module is configured to: input the water quality index on each section into the diffusion model and solve the coefficient of the diffusion model;
[0024] The result output module is configured to: construct a water quality prediction model based on the coefficients of the diffusion model to perform spatiotemporal prediction of water quality.
[0025] In a third aspect, the present invention provides an electronic device comprising a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method described in the first aspect is performed.
[0026] In a fourth aspect, the present invention provides a computer-readable storage medium for storing computer instructions, wherein when the computer instructions are executed by a processor, the method described in the first aspect is performed.
[0027] In a fifth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method described in the first aspect.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] The present invention proposes a spatiotemporal prediction method and system for water quality by coupling LSTM and diffusion models. The prediction performance of the LSTM model on a time scale and the prediction ability of the diffusion model on a space scale are utilized to effectively couple the two models, thereby constructing a spatiotemporal prediction model for water quality. The prediction on a time scale is a daily scale, and the prediction on a space scale can cover any position of the river. The prediction of water quality indicators on both time and space scales is achieved, thereby achieving spatiotemporal prediction of water quality indicators of the target river. Compared with the traditional prediction method based on data-driven methods in discrete sections, the spatiotemporal deduction of water quality indicator prediction in discrete sections can be achieved, which is helpful for the rapid and effective identification of water quality anomalies in any section of the river. It provides effective data and technical support for water environment monitoring and supervision, water pollution prediction and early warning, and pollution source tracing and other management work.
[0030] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0032] Figure 1 Process of the water quality spatiotemporal prediction method of coupling LSTM and diffusion model provided in Example 1 of the present invention Figure 1 ;
[0033] Figure 2 Process of the water quality spatiotemporal prediction method of coupling LSTM and diffusion model provided in Example 1 of the present invention Figure 2 . DETAILED DESCRIPTION
[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 descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0036] It should be noted that the terms used herein are only for describing specific embodiments, and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that the terms "include" and "have" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0037] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0038] Example 1
[0039] like Figure 1-2 As shown, this embodiment provides a water quality spatiotemporal prediction method coupling LSTM and diffusion model, including the following steps:
[0040] S1 collects monitoring data from each water quality monitoring section and other data related to water quality spatiotemporal prediction, and performs preprocessing;
[0041] S2 analyzes the collected data to obtain the driving factors of each water quality index;
[0042] S3 inputs the driving factors into the LSTM model, trains the LSTM model, and obtains water quality indicators at each water quality monitoring section;
[0043] S4 inputs the water quality index on each section into the diffusion model to solve the coefficient of the diffusion model;
[0044] S5 constructs a water quality prediction model based on the coefficients of the diffusion model to make spatiotemporal predictions of water quality.
[0045] Other data related to the spatiotemporal 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. The present disclosure first collects daily-scale monitoring data of multiple water quality monitoring sections of a river (including pH, total nitrogen, total phosphorus, dissolved oxygen, conductivity, ammonia nitrogen, turbidity, permanganate index, water temperature and other indicators); meteorological data (including temperature, precipitation, evaporation, etc.), land use data, population data, hydrological data of hydrological stations (including flow, water level, etc.) in the area where each section is located, and pre-processes the data through interpolation, missing value filling, normalization and other methods.
[0046] The collected data were analyzed using the Spearman correlation analysis method, and variables with high correlation with the prediction indicators (i.e., water quality indicators) were extracted as driving factors of each water quality indicator and input features of the LSTM model. The time series data was converted into a supervised learning method, and the data was divided into training sets and test sets in a ratio of 7:3. A water quality prediction model on a time scale was constructed and trained at each section. The LSTM model was built using the Keras library in Python, and the LSTM layer, RepeatVector layer, TimeDistributed layer, etc. were set, and the activation function, optimizer, and loss function were set. Parameters such as epochs and batch_size for LSTM model training were set.
[0047] The diffusion model is a one-dimensional water quality model, which 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-sectional flow, q is the lateral inflow per unit river length, A is the cross-sectional area, Z is the cross-sectional water level, n is the river channel roughness, h is the cross-sectional water depth, g is the gravitational acceleration, x is the coordinate in the X direction of the Cartesian coordinate system, and t is time.
[0051] The basic equation of the water temperature mathematical model is:
[0052]
[0053] Where T is the water temperature, E tx is the longitudinal diffusion coefficient of water temperature, T L is the side inlet and outlet water temperature, ρ 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-sectional flow velocity, and B is the width of the water surface.
[0054] The basic equation for the mathematical model of water quality is:
[0055]
[0056] Among them, E x is the pollutant longitudinal diffusion coefficient, C L is the pollutant concentration of the lateral inlet and outlet, C is the pollutant concentration, and f(C) is the biochemical reaction term.
[0057] The present invention solves the coefficients of the diffusion model using two analytical methods: continuous stable discharge and limited time period discharge. In the continuous stable discharge, two sections are used as upstream and downstream concentrations. The coefficients are solved by substituting the distance between the sections. It selects the analytical formula based on the simplification of the one-dimensional water quality model equation in the longitudinal direction of the river and the classification of the judgment conditions (i.e., the critical values of the O'Connor number α and the Beckley number Pe). Under different judgment conditions, the convection degradation model, the simplified convection diffusion degradation model, the convection 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 Beckley number Pe are as follows:
[0058]
[0059] Where k is the comprehensive attenuation coefficient of pollutants, unit: s -1 ; E x is the longitudinal diffusion coefficient of pollutants, in m 2 / s; u is the flow velocity, unit is m / s; B is the water surface width, unit is m.
[0060] When α≤0.027 and Pe≥1, the convection degradation model is applicable:
[0061]
[0062] When α≤0.027 and Pe<1, the simplified convection-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 convection-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 within 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 that the concentration of water quality indicators at different positions can be solved. 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 spatiotemporal prediction system that couples LSTM and diffusion models, including:
[0079] The data acquisition module is configured to: collect monitoring data on each water quality monitoring section and other data related to water quality spatiotemporal prediction, and perform preprocessing;
[0080] The data analysis module is configured to: analyze the collected data to obtain the driving factors of each water quality indicator;
[0081] The water quality index prediction module is configured to: input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality index on each water quality monitoring section;
[0082] The model analysis module is configured to: input the water quality index on each section into the diffusion model and solve the coefficient of the diffusion model;
[0083] The result output module is configured to: construct a water quality prediction model based on the coefficients of the diffusion model to perform spatiotemporal prediction of water quality.
[0084] It should be noted that the above modules correspond to the steps described in Example 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 contents disclosed in the above Example 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 further embodiments, there is also provided:
[0086] An electronic device includes a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method described in Embodiment 1 is performed. For the sake of brevity, it will not be described in detail 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 portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0089] A computer-readable storage medium is used to store computer instructions, and when the computer instructions are executed by a processor, the method described in Example 1 is completed.
[0090] The method in Example 1 can be directly embodied as a hardware processor, or a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it is not described in detail here.
[0091] A computer program product includes a computer program, and when the computer program is executed by a processor, the method described in embodiment 1 is implemented.
[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 a program module, which are executed in a device on a real or virtual processor of the target to perform the process / method as described above. Typically, 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 between program modules as needed. Machine executable instructions for program modules can be executed in local or distributed devices. In distributed devices, 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 the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the computer or other programmable data processing device, causes the function / operation specified in the flow chart and / or block diagram to be implemented. The program code can be executed completely on a computer, partially on a computer, as an independent software package, partially on a computer and partially on a remote computer or completely on a remote computer or server.
[0094] In the context of the present invention, computer program codes or related data may be carried by any appropriate carrier to enable a device, apparatus or processor to perform the various processes and operations described above. Examples of carriers include signals, computer readable media, and the like. Examples of signals may include electrical, optical, radio, acoustic or other forms of propagation signals, such as carrier waves, infrared signals, and the like.
[0095] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with this embodiment can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0096] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. A spatiotemporal water quality prediction method coupling LSTM and diffusion model, characterized in that: The following steps are involved: Collect monitoring data from each water quality monitoring section and other data related to water quality spatiotemporal prediction, and perform preprocessing; Analyze the collected data to obtain the driving factors of each water quality indicator; The driving factors are input into the LSTM model, and the LSTM model is trained to obtain water quality indicators at each water quality monitoring section; Input the water quality indexes at each section into the diffusion model and solve the coefficients of the diffusion model; A water quality prediction model is constructed based on the coefficients of the diffusion model to make spatiotemporal predictions of water quality.
2. A water quality spatiotemporal prediction method for coupling LSTM and diffusion model as claimed in claim 1, characterized in that: Other data related to the spatiotemporal prediction of water quality include meteorological data, land use data, population data and hydrological data of hydrological stations in the section area.
3. A water quality spatiotemporal prediction method for coupling LSTM and diffusion model as claimed in claim 1, characterized in that: The collected data were analyzed using the Spearman correlation analysis method, and variables with high correlation with water quality indicators were extracted as driving factors for each water quality indicator.
4. A water quality spatiotemporal prediction method for coupling LSTM and diffusion model as claimed in claim 1, characterized in that: The diffusion model is a one-dimensional water quality model, which includes a one-dimensional hydrodynamic mathematical model, a water temperature mathematical model and a water quality mathematical model.
5. A water quality spatiotemporal prediction method for coupling LSTM and diffusion model as claimed in claim 1, characterized in that: The analytical methods for solving the coefficients of the diffusion model include continuous stable emission and finite period emission. The analytical process of continuous stable emission selects the corresponding analytical solution formula by judging the O'Connor number α and the Beckley number Pe.
6. A water quality spatiotemporal prediction method for coupling LSTM and diffusion model as claimed in claim 5, characterized in that: For emissions over a limited period of time, the coefficients are solved using the dichotomy method; For continuous and stable discharge, the two sections are taken as the upstream and downstream concentrations, and the coefficients are solved by substituting the distance between the sections.
7. A spatiotemporal water quality prediction system coupling LSTM and diffusion model, characterized in that: include: The data acquisition module is configured to: collect monitoring data on each water quality monitoring section and other data related to water quality spatiotemporal prediction, and perform preprocessing; The data analysis module is configured to: analyze the collected data to obtain the driving factors of each water quality indicator; The water quality index prediction module is configured to: input the driving factors into the LSTM model, train the LSTM model, and obtain the water quality index on each water quality monitoring section; The model analysis module is configured to: input the water quality index on each section into the diffusion model and solve the coefficient of the diffusion model; The result output module is configured to: construct a water quality prediction model based on the coefficients of the diffusion model to perform spatiotemporal prediction of water quality.
8. An electronic device, characterized in that: The method comprises a memory and a processor and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method according to any one of claims 1 to 6 is completed.
9. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the method described in any one of claims 1 to 6.
10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
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
Urban river network transparency prediction method jointly driven by mechanism model and data
CN117633721A
Cited By
CDOM prediction method based on multi-source driving factor and related device
CN120598099A
Pollution source detection method and system based on water environment treatment
CN121521880A
