Open channel water quality prediction method of coupling mechanism and non-mechanism model

By combining mechanism and non-mechanical models in open channel water quality prediction and using LSTM model for prediction, the problem of insufficient water quality prediction accuracy in the existing technology is solved, and higher prediction accuracy and accuracy are achieved, providing a scientific basis for water environment governance.

CN119884558AActive Publication Date: 2025-04-25CHINA INST OF WATER RESOURCES & HYDROPOWER RES

Patent Information

Application Number
CN202411677162.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-04-25
Estimated Expiration
2044-11-22

AI Technical Summary

Technical Problem

The prior art is difficult to meet the accuracy requirements for open channel water quality prediction, especially in complex water environment systems.

Method used

The coupling mechanism and non-mechanical model are used to predict the flow rate and water quality in the short term by constructing one-dimensional hydrodynamic and water quality models and combining the LSTM model.

Benefits of technology

It improves the accuracy and accuracy of water quality prediction, provides important tools for water quality trend prediction and pollution warning, and helps formulate scientific water environment governance plans.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884558A_ABST
    Figure CN119884558A_ABST
Patent Text Reader

Abstract

The invention discloses an open channel water quality prediction method of a coupling mechanism and non-mechanism model. The method comprises the following steps: step 1, data collection; 2, constructing an open channel mechanism model; 3, constructing an open channel non-mechanism model; and 4, predicting the water quality of the open channel. According to the method, a mechanism model and a non-mechanism model are coupled, the advantages of two types of water quality prediction methods are combined, the upper boundary flow and water quality conditions in the future short period are predicted through an LSTM model, the prediction result serves as the upper boundary of the hydrodynamic force and water quality model, and then the water quality change conditions of all cross sections along the way of the channel in the future short period are predicted. The method improves the precision and accuracy of water quality prediction, is an important tool for developing water quality trend prediction and pollution early warning research and judgment, provides technical guarantee for water quality safety intelligent management, and provides a certain scientific basis for solving water environment pollution and making related plans.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of water quality prediction, and in particular relates to an open channel water quality prediction method of a coupling mechanism and a non-mechanism model. Background Art

[0002] Water quality prediction is the basic and prerequisite work for achieving precise water pollution control. In order to grasp the pollution situation of the water environment, it is necessary to timely and effectively predict and deduce the future water quality change trend in the event of sudden water pollution incidents and seasonal water quality problems, grasp the temporal and spatial change process of pollutants and formulate disposal plans in advance. At present, there are two common prediction methods: mechanism method and non-mechanism method. The mechanism method is a water quality model that uses mathematical language to describe the physical, chemical, biological and ecological changes, internal laws and interrelationships of water quality components in water bodies. Commonly used models include Streeter-Phelps, QUAL model, WASP model, QUASAR model, MIKE model, etc.; non-mechanism models include gray model prediction method and artificial neural network model prediction method. Among them, the artificial neural network model belongs to the black box model, and each neuron has the ability to independently calculate and process. For the same network structure, it can handle both linear problems and nonlinear problems. When solving problems, there is no requirement for the structure of the actual problem, and there is no need to make any assumptions about the relationship between variables. Therefore, it has been widely used in various fields.

[0003] With the rapid development of society and the accelerated pace of urbanization, the water environment system has deteriorated. The unique complexity of the water environment system makes it difficult to meet the prediction accuracy requirements by simply using traditional mechanistic and non-mechanistic methods. Therefore, it is urgent to establish a water quality prediction method that couples mechanism and non-mechanism models to provide a certain scientific basis for solving water environment pollution and formulating relevant plans. Summary of the invention

[0004] The purpose of the present invention is to provide an open channel water quality prediction method of coupling mechanism and non-mechanism model to solve the above technical problems.

[0005] To achieve the above object, the present invention provides the following technical solutions:

[0006] The present invention discloses a method for predicting open channel water quality by coupling mechanism and non-mechanism model, the method comprising the following steps:

[0007] Step 1, data collection: collect channel cross-section data of the open channel, historical hydrodynamic data, the location and historical flow data of the water outlet and the water diversion outlet, the location of the regulating gate and the historical measured gate opening, the water level before the gate and the water level after the gate, and the historical water quality data; the historical hydrodynamic data include the upper boundary flow and water level, and the lower boundary water level data; the historical water quality data include the upper boundary water quality data and the water quality data of the water quality monitoring points along the line, and the water quality data are the permanganate index, total nitrogen, total phosphorus, and ammonia nitrogen concentration data;

[0008] Step 2: Construct an open channel mechanism model: Based on the collected data, construct an open channel mechanism model, including a one-dimensional hydrodynamic model and a one-dimensional water quality model;

[0009] Step 3: Construct an open channel non-mechanism model: Construct an LSTM model to extract internal rules from the historical flow and water quality data of the upper boundary, and use the advantages of the LSTM model's selective memory to predict the future short-term flow and water quality. That is, the collected historical flow and water quality data of the upper boundary are pre-processed and used as the input of the LSTM model, and the output is the flow and water quality data of the upper boundary in the short term in the future;

[0010] Step 4. Predict the water quality of the open channel: Couple the one-dimensional hydrodynamic and water quality models with the LSTM model to predict the water quality of all sections of the open channel in the short term in the future. The preprocessed upper boundary historical flow and water quality data are used as the input of the LSTM model. The model output is the flow and water quality data of the upper boundary in the short term in the future. Then, the output of the LSTM model is used as the upper boundary condition of the one-dimensional hydrodynamic and water quality model to predict the water quality results of all sections along the open channel in the short term in the future.

[0011] Furthermore, the data collected in step 1 are obtained through two methods: automatic monitoring stations and on-site monitoring. The collected upper boundary flow and upper boundary water quality data are long series data with a time length of not less than 5 years; the time length of other historical data is not less than 1 year.

[0012] Furthermore, the specific process of constructing the one-dimensional hydrodynamic model described in step 2 is: first, interpolate the terrain elevation based on the large-section data of the channel, then set the upper boundary and lower boundary conditions according to the upper boundary flow and water level, and lower boundary water level data respectively, set the initial conditions according to the upper boundary initial flow and the upper boundary initial water level, that is, the flow and water level at the starting time, then set the source and sink terms according to the location and historical flow of the water withdrawal port and the water diversion port, and set the inner boundary conditions based on the location of the regulating gate and the historical measured gate opening;

[0013] The Saint-Venant equations, including the mass conservation equation and the momentum conservation equation, are used to couple the gate flow control equation to achieve continuous simulation of the channel hydraulic response process.

[0014] The two adjacent sections, namely section X L and section X R The river section between the two is taken as a control unit. The division of the control unit comprehensively considers the model simulation area, water flow characteristics, calculation efficiency and key physical process factors. The size and distribution of the control unit can capture the changes in flow characteristics.

[0015] Then the mass conservation equation is:

[0016]

[0017] Where: Q is the upper boundary flow, m 3 / s; A is the cross-sectional area of ​​water flow, m 2 ; I is the lateral inflow flow, including the flow of the water outlet and the water diversion outlet, m 3 / s; x is the length of the river section, m; t is the time, s; x L is the upstream boundary position of the control unit, m; x R is the downstream boundary position of the control unit, m; t D Calculate the starting time for the control unit, s; t U t D The time corresponding to the next time step, s;

[0018] The momentum conservation equation is:

[0019]

[0020] Where: β is the momentum-flow correction coefficient, dimensionless; V is the volume of the control body, m 3 ; g is the acceleration due to gravity, m / s 2 ; J is the initial cross-sectional area, m 2 ; is the correction value of J, dimensionless; S0 is the bottom slope, %; S f is the friction slope, dimensionless; C D (w) ρ a U 2 is the wind-induced shear pressure, N·s / m 3 ; C D (w) is the wind-induced shear pressure coefficient, dimensionless; U is the wind speed; ρ a is the wind density, kg / m 3 ; ρ is water density, kg / m 3 ; ψ is the angle between the downstream flow direction and the wind direction, degree; T is the water surface width, m;

[0021] The gate overcurrent control equation is:

[0022] For the gated flow channel section, the water flow meets the continuity condition at any time. Assuming that the flow rate of the section before the control gate is equal to the flow rate of the section after the control gate, the following formula is obtained:

[0023]

[0024] In the formula, Q gz is the flow rate through the gate, m 3 / s,Q gz =Q+I; the variable superscript indicates the calculation time, i.e. j+1 indicates the j+1 time; the variable subscript indicates the section number, i.e. i indicates the i-th section;

[0025] When regulating water flow, the water flow state at the control gate is weir flow or gate hole outflow. According to whether the downstream water level affects the flow capacity, it is divided into gate hole free outflow, gate hole submerged outflow, weir flow free outflow and weir flow submerged outflow;

[0026] According to the criteria for distinguishing weir flow and gate hole outflow, when e / H i When ≤0.65, the flow rate under the gate should be calculated according to the gate hole outflow formula:

[0027] when When , the gate hole is free outflow:

[0028]

[0029] when When , the gate hole is submerged outflow:

[0030]

[0031] Where, b is the gate hole width, m; e is the gate hole opening, m; H i is the water depth of the section, m; is the water depth downstream of the gate at the time of calculation, m; is the water depth of the contraction section at the time of calculation, m; ε j+1 is the lateral contraction coefficient of the gate at the time of calculation, dimensionless; φ is the velocity coefficient, dimensionless; μ is the free outflow coefficient of the wide crest weir gate hole, dimensionless; σ s is the flooded outflow coefficient of the gate hole, dimensionless; is the total head of the section including the velocity head at the time of calculation, m;

[0032] According to the criteria for distinguishing weir flow and gate hole outflow, when e / H i When >0.65, the weir flow formula is used for calculation:

[0033] when When , the weir flow submerges the outflow:

[0034]

[0035] when When , it is the free outflow of weir flow:

[0036]

[0037] In the formula, The depth of water behind the gate when the downstream water level exceeds the weir crest at the calculation time, m; is the water depth of the downstream section at the time of calculation, m; z s is the elevation of the weir bottom, m; μ is the overflow coefficient, dimensionless; the flow Q is the gate opening e, the upstream water level and downstream water level The function of m 3 / s.

[0038] Furthermore, the specific process of constructing the one-dimensional water quality model in step 2 is: based on the upper boundary water quality data, the water quality boundary is set, and the one-dimensional water quality model is constructed on the basis of the one-dimensional hydrodynamic model, that is, on the basis of the flow and water level calculated by the St. Vincent South steady flow model, the convection diffusion, dilution, self-reaction of water quality components, interaction between water quality components and the influence of external sources and sinks of components on component concentrations of water quality indicators in the water body are considered, and a one-dimensional mathematical model describing water quality is established for a certain concentration c. i The equilibrium equation of water quality index between section i-1 and section i is:

[0039]

[0040] Where: c i is the water quality index concentration, mg / L; Q i-1 is the inflow flow rate of section i-1, m 3 / s;Q i is the outflow rate of section i, m 3 / s;Q out is the water intake flow between section i-1 and section i, m 3 / s; V i is the volume between section i-1 and section i, m 3 ; E i ' and E i-1 ' are the diffusion coefficients of section i and section i-1, respectively, m 3 / d;W i is the exogenous input, mg / d; t is the time, s; k is the first-order degradation coefficient of the substance calculated by simulation, d -1 ;

[0041] The model parameters are calibrated using water quality data from water quality monitoring sections along the route, so that the error between the simulated water quality results and the measured values ​​at the sections along the route is within the allowable error range.

[0042] Furthermore, the specific process of constructing the LSTM model in step 3 is as follows: the LSTM model is a time recursive neural network model. The LSTM model selectively retains information through a gating mechanism. There are three gates in the LSTM unit, namely the input gate, the forget gate, and the output gate. The input gate determines which new information is stored in the unit state; the forget gate controls the internal state C of the previous time. t-1 How much information needs to be forgotten; the output gate controls the internal state C at the current moment t How much information needs to be output to the external state h t , the calculation formula is as follows:

[0043] i t =σ(w i [x t ,h t-1 +b i ]) (9)

[0044] f t =σ(w f [x t ,h t-1 +b f ]) (10)

[0045] o t =σ(w o [x t ,h t-1 +b o ]) (11)

[0046] In the formula, σ() is the Sigmoid activation function, with a value between [0,1], indicating the weight of letting information pass through, i t is the output of the input gate; w i is the weight matrix of the input gate; f t is the output of the forget gate; w f is the weight matrix of the forget gate; o t is the output of the output gate, w o is the weight matrix of the output gate;

[0047] The collected upper boundary historical flow and water quality data are preprocessed, including missing value processing, data slicing, and data normalization, to ensure data quality and availability; the preprocessed data is used as training data to train the model, and the model prediction results are verified. If the prediction error is within 5%, it indicates that the prediction effect is ideal, that is, the model training is completed.

[0048] Furthermore, the missing value processing is: Lagrange interpolation method and piecewise linear interpolation method are used in combination, and the specific formula is as follows:

[0049]

[0050]

[0051] Where: x k is a missing value, x i and x j They are missing value base data and non-base data, For x k Interpolation results of missing values; In order to avoid oscillation of Lagrange interpolation due to too large an interpolation range, the piecewise interpolation method is combined in a small range and adjusted according to the measured data to ensure compliance with the law;

[0052] The data slicing is as follows: determining the time step of input and output data during the training of the LSTM model; dividing the training set and the test set into 7:3, i.e., 70% for the training set and 30% for the test set; slicing the data in the form of a sliding window to determine the optimal window value;

[0053] x t+1 =f(x t-n , x t-n+1 ,…,x t ) (14)

[0054] In the formula [x t-n , x t-n+1, …,x t ] is used as input, which is a sliding window in the whole training process. The data of fixed time length passes through this window to train the time series model; x t+1 As input; n is the data time length;

[0055] The data normalization process is: using the min-max standardization method to normalize the data, the formula is as follows:

[0056]

[0057] Where x is the original sample data; min(x) and max(x) are the minimum and maximum values ​​of the original sample data, respectively.

[0058] Furthermore, the specific process of coupling the one-dimensional hydrodynamic and water quality models with the LSTM model described in step 4 is: integrating the LSTM model with the one-dimensional hydrodynamic and water quality models through the Fortran language, that is, linking the flow and water quality data of the upper boundary of the LSTM model output in the short term in the future to the boundary conditions of the one-dimensional hydrodynamic and water quality models, and predicting the water quality of each section of the open channel in the short term in the future. During the prediction process, it is necessary to set the number of iterations n_estimators, the maximum depth of the tree max_depth, the learning rate learning_rate, the minimum shunt loss min_gamma, and the minimum leaf node sample weight sum min_child_weight. During the prediction process, the initial value of the learning rate is set to 0.1, and the grid search method is used to first optimize the number of iterations and the maximum depth of the tree, and then the grid search method is continued to be used to optimize the learning rate parameters, and finally the minimum shunt loss and the minimum leaf node sample weight parameters are set.

[0059] The beneficial effects of the present invention are as follows: the method of the present invention combines the advantages of two types of water quality prediction methods by coupling the mechanism model and the non-mechanism model, predicts the upper boundary flow and water quality in the short term in the future through the LSTM model, and uses the prediction results as the upper boundary of the hydrodynamic and water quality model to further predict the water quality changes in each section along the channel in the short term in the future. The method of the present invention improves the precision and accuracy of water quality prediction, is an important tool for conducting water quality trend prediction and pollution early warning research and judgment, provides technical support for the intelligent management of water quality safety, and provides a certain scientific basis for solving water environment pollution and formulating relevant plans.

[0060] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 It is a schematic diagram of the process of the method of the present invention;

[0062] Figure 2 is a schematic diagram of a control unit;

[0063] Figure 3 It is a schematic diagram of the cross section of the upstream Taocha Canal Head and the downstream Beijuma River in Example 1;

[0064] Figure 4 This is a schematic diagram of the upper boundary flow process in Example 1;

[0065] Figure 5 This is a schematic diagram of the lower boundary water level process in Example 1;

[0066] Figure 6 It is a schematic diagram comparing the simulated results of the water level before the gate, the water level after the gate, and the flow through the gate with the measured results in the first embodiment;

[0067] Figure 7 This is a schematic diagram of the change process of water quality data on the upper boundary of the water quality model in Example 1;

[0068] Figure 8 This is a schematic diagram of the comparison results between the water quality model simulation and the actual measurement in Example 1;

[0069] Fig. 9 This is a schematic diagram of LSTM model calibration and verification in Example 1;

[0070] Fig.10 This is a comparison diagram of the water quality simulation and actual measurement results along the main sections in Example 1. DETAILED DESCRIPTION

[0071] The present invention discloses a method for predicting open channel water quality by coupling mechanism and non-mechanism model, such as Figure 1 As shown, the method comprises the following steps:

[0072] Step 1, data collection: collect channel cross-section data of open channels, historical hydrodynamic data (including upper boundary flow and water level, lower boundary water level, etc.), the location and historical flow data of water outlets and water diversion outlets, the location of hydraulic structures such as regulating gates and historical measured gate openings, water levels before and after the gates, and other data, and historical water quality data (including upper boundary water quality data and water quality data of water quality monitoring points along the line, water quality data are permanganate index, total nitrogen, total phosphorus, ammonia nitrogen and other concentration data). These data are generally obtained through two methods: automatic monitoring stations and on-site monitoring supplementary collection. Among them, the collected upper boundary flow and upper boundary water quality data are long series data, and the time length is generally not less than 5 years; the time length of other historical data is generally not less than 1 year.

[0073] Step 2: Construct an open channel mechanism model: Based on the collected data, construct an open channel mechanism model, including a one-dimensional hydrodynamic model and a one-dimensional water quality model, which specifically includes the following steps:

[0074] Step 21. Construct a one-dimensional hydrodynamic model: Construct a one-dimensional hydrodynamic model that can simulate complex hydraulic structures. First, interpolate the terrain elevation based on the large-section data of the channel. Then, set the upper and lower boundary conditions according to historical hydrodynamic data such as the upper boundary flow and water level, and the lower boundary water level. Set the initial conditions according to the upper boundary initial flow and the upper boundary initial water level (i.e., the flow and water level at the starting time). Then, set the source and sink items according to the location and historical flow of the water outlet and the diversion outlet. Set the inner boundary conditions based on the location of hydraulic structures such as the regulating gate and the historical measured gate opening.

[0075] The Saint-Venant equations, which include the continuity equation reflecting the law of conservation of mass (mass conservation equation) and the motion equation reflecting the law of conservation of momentum (momentum conservation equation), are coupled with the gate flow control equation to achieve continuous simulation of the channel hydraulic response process.

[0076] Among them, the two adjacent sections, namely section X L and section X R The river section between the two is taken as a control unit, such as Figure 2 The following is a schematic diagram of the control unit. The division of the control unit needs to comprehensively consider factors such as the model simulation area, water flow characteristics, computational efficiency, and key physical processes. The size and distribution of the control unit usually need to accurately capture the changes in complex flow characteristics such as water flow velocity and direction.

[0077] The mass conservation equation is:

[0078]

[0079] Where: Q is the upper boundary flow, m 3 / s; A is the cross-sectional area of ​​water flow, m 2 ; I is the lateral inflow flow (including the flow of the water outlet and the water diversion outlet), m 3 / s; x is the length of the river section, m; t is the time, s; x L is the upstream boundary position of the control unit, m; x R is the downstream boundary position of the control unit, m; t D Calculate the starting time for the control unit, s; t U t D The time corresponding to the next time step, s.

[0080] The momentum conservation equation is:

[0081]

[0082] Where: β is the momentum-flow correction coefficient, dimensionless; V is the volume of the control body, m 3 ; g is the acceleration due to gravity, m / s 2 ; J is the initial cross-sectional area, m 2 ; is the correction value of J, dimensionless; S0 is the bottom slope, %; S f is the friction slope, dimensionless; C D (w) ρ a U 2 is the wind-induced shear pressure, N·s / m 3 ; C D (w) is the wind-induced shear pressure coefficient, dimensionless; U is the wind speed; ρ a is the wind density, kg / m3 ; ρ is water density, kg / m 3 ; ψ is the angle between the downstream flow direction and the wind direction, degrees; T is the water surface width, m.

[0083] Gate overcurrent control equation:

[0084] For a general gated channel section, the water flow meets the continuity condition at any time. Assuming that the flow rate in the section before the control gate is equal to the flow rate in the section after the control gate, the following formula can be obtained:

[0085]

[0086] In the formula, Q gz is the flow rate through the gate, m 3 / s,Q gz =Q+I; the superscript of the variable indicates the calculation time, such as j+1 indicates the j+1 time; the subscript of the variable indicates the section number, such as i indicates the i-th section.

[0087] When regulating water flow, the water flow state at the control gate may be either weir flow or gate hole outflow. According to whether the downstream water level affects the flow capacity, it can be specifically divided into gate hole free outflow, gate hole submerged outflow, weir flow free outflow and weir flow submerged outflow. The corresponding empirical formula is generally obtained through experiments.

[0088] According to the criteria for distinguishing weir flow and gate hole outflow, when e / H i When ≤0.65, the flow rate under the gate should be calculated according to the gate hole outflow formula:

[0089] when When , the gate hole is free outflow:

[0090]

[0091] when When , the gate hole is submerged outflow:

[0092]

[0093] Where, b is the gate hole width, m; e is the gate hole opening, m; H i is the water depth of the section, m; is the water depth downstream of the gate at the time of calculation, m; is the water depth of the contraction section at the time of calculation, m; ε j+1 is the lateral contraction coefficient of the gate at the time of calculation, dimensionless; φ is the velocity coefficient, dimensionless; μ is the free outflow coefficient of the wide crest weir gate hole, dimensionless; σ s is the flooded outflow coefficient of the gate hole, dimensionless; is the total head of the section including the velocity head at the time of calculation, m.

[0094] According to the criteria for distinguishing weir flow and gate hole outflow, when e / H i When >0.65, the weir flow formula should be used for calculation.

[0095] when When , the weir flow submerges the outflow:

[0096]

[0097] when When , it is the free outflow of weir flow:

[0098]

[0099] In the formula, The depth of water behind the gate when the downstream water level exceeds the weir crest at the calculation time, m; is the water depth of the downstream section at the time of calculation, m; z s is the elevation of the weir bottom, m; μ is the overflow coefficient, dimensionless; the flow Q is the gate opening e, the upstream water level and downstream water level The function of m 3 / s.

[0100] Step 22, construct a one-dimensional water quality model: based on the upper boundary water quality data, set the water quality boundary, construct a one-dimensional water quality model based on the one-dimensional hydrodynamic model, and use the water quality data of the water quality monitoring sections along the line to calibrate the model parameters so that the error between the water quality simulation results and the measured values ​​of the sections along the line is within a reasonable range (allowable error range).

[0101] Based on the flow and water level calculated by the St. Vincent South Steady Flow Model, a one-dimensional mathematical model describing water quality is established, taking into account the convection diffusion, dilution, self-reaction of water quality components, interaction between water quality components, and the influence of external sources and sinks on component concentrations of water quality indicators (such as total nitrogen, total phosphorus, ammonia nitrogen, permanganate index, etc.) in the water body. i The equilibrium equation of water quality index between section i-1 and section i is:

[0102]

[0103] Where: c i is the water quality index concentration, mg / L; Q i-1 is the inflow flow rate of section i-1, m 3 / s;Q i is the outflow rate of section i, m 3 / s;Q out is the water intake flow between section i-1 and section i, m 3 / s; V i is the volume between section i-1 and section i, m3 ; E i ' and E i-1 ' are the diffusion coefficients of section i and section i-1, respectively, m 3 / d;W i is the exogenous input, mg / d; t is the time, s; k is the first-order degradation coefficient of the substance calculated by simulation, d -1 .

[0104] Step 3: Construct an open channel non-mechanism model: Construct an LSTM (Long Short-Term Memory Artificial Neural Network) model: The LSTM model is a time recursive neural network model that is good at processing and predicting events with relatively long time series intervals and delays. The LSTM model selectively retains information through a gating mechanism. There are three gates in the LSTM unit, namely the input gate, the forget gate, and the output gate. The input gate determines which new information is stored in the unit state; the forget gate controls the internal state C of the previous time. t-1 How much information needs to be forgotten; the output gate controls the internal state C at the current moment t How much information needs to be output to the external state h t , the calculation formula is as follows:

[0105] i t =σ(w i [x t ,h t-1 +b i ]) (9)

[0106] f t =σ(w f [x t ,h t-1 +b f ]) (10)

[0107] o t =σ(w o [x t ,h t-1 +b o ]) (11)

[0108] In the formula, σ() is the Sigmoid activation function, with a value between [0,1], indicating the weight of letting information pass through, i t is the output of the input gate; w i is the weight matrix of the input gate; f t is the output of the forget gate; w f is the weight matrix of the forget gate; o t is the output of the output gate, w o is the weight matrix of the output gate.

[0109] Internal rules are extracted from the historical flow and water quality data of the upper boundary, and the advantages of selective memory of the LSTM model are used to predict future short-term flow and water quality. That is, the collected historical flow and water quality data of the upper boundary are preprocessed and used as the input of the LSTM model, and the output is the flow and water quality data of the upper boundary in the short term in the future (generally one week).

[0110] The collected upper boundary historical flow and water quality data are preprocessed, including missing value processing, data slicing, data normalization and other operations to ensure the quality and availability of the data. The preprocessed data is used as training data to train the model and verify the model prediction results. If the prediction error is within 5%, it indicates that the prediction effect is ideal, that is, the model training is completed.

[0111] Specifically, the missing value processing is: Lagrange interpolation method and piecewise linear interpolation method are used in combination. The specific formula is as follows:

[0112]

[0113] Where: x k is a missing value, x i and x j They are missing value base data and non-base data, For x k Interpolation results of missing values. In order to avoid the oscillation of Lagrange interpolation due to the large interpolation range, the piecewise interpolation method is combined in a small range and adjusted according to the measured data to ensure compliance with the law.

[0114] Data slicing is as follows: Determine the time step of input and output data during the training of the LSTM model. The training set and test set are divided into 7:3, that is, 70% for the training set and 30% for the test set. Slice the data in the form of a sliding window to determine the optimal window value.

[0115] x t+1 =f(x t-n , x t-n+1 ,…,x t ) (14)

[0116] In the formula [x t-n , x t-n+1 ,…,x t ] is used as input, which is a sliding window in the whole training process. The data of fixed time length passes through this window to train the time series model; x t+1 as input; n is the data time length; using different historical length data to train the model will produce different results.

[0117] Data normalization is as follows: The magnitude differences of different water quality indicators are large, so they need to be standardized to prevent divergence during model training. The min-max normalization method is used to normalize the data, and the formula is as follows:

[0118]

[0119] Where x is the original sample data; min(x) and max(x) are the minimum and maximum values ​​of the original sample data, respectively.

[0120] Step 4: Predict the water quality of the open channel: Couple the one-dimensional hydrodynamic and water quality model with the LSTM model to predict the water quality of all sections of the open channel in the short term in the future. The specific process of prediction is: use the pre-processed upper boundary historical measured flow and water quality data as the input of the LSTM model, and the model output is the flow and water quality data of the upper boundary in the short term in the future. Then use the output of the LSTM model as the upper boundary condition of the one-dimensional hydrodynamic and water quality model to predict the water quality results of all sections along the open channel in the short term in the future (i.e., the concentration of water quality indicators such as permanganate index, total nitrogen, ammonia nitrogen, and total phosphorus).

[0121] Specifically, the LSTM model is integrated with the one-dimensional hydrodynamic and water quality models through the Fortran language, that is, the flow and water quality data of the upper boundary output of the LSTM model in the short term in the future are linked to the boundary conditions of the one-dimensional hydrodynamic and water quality models, and the water quality of each section of the open channel in the short term in the future is predicted. During the prediction process, it is necessary to set the number of iterations (n_estimators), the maximum depth of the tree (max_depth), the learning rate (learning_rate), the minimum diversion loss (min_gamma), and the minimum leaf node sample weight sum (min_child_weight). During the prediction process, the initial value of the learning rate is set to 0.1, and the grid search method is used to first optimize the number of iterations and the maximum depth of the tree, and then the grid search method is continued to optimize the learning rate parameters, and finally the minimum diversion loss and the minimum leaf node sample weight parameters are set.

[0122] Embodiment 1

[0123] This embodiment is an application example of the above method.

[0124] This embodiment discloses a method for predicting open channel water quality by coupling mechanism and non-mechanism model, comprising the following steps:

[0125] Step 1. Data collection: Collect topographic data of the large section of the Taocha-Bei Juma River, the flow and water level process of the upper boundary Taocha section in 2018, the water level process of the downstream Bei Juma River section in 2018, the location and flow of the water withdrawal and diversion outlets along the way, the water level before the gate, the water level after the gate and the flow through the gate of each regulating gate along the way in 2018, the water quality process of the upper boundary Taocha section in 2018, and the water quality process of each water quality monitoring section along the way in 2018.

[0126] Step 2: Construct an open channel mechanism model: Construct a one-dimensional hydrodynamic model and a water quality model. Taking the middle route of the South-to-North Water Diversion Project as an example, the simulation range is from the Taocha Canal Head to the North Juma River, with a total length of 1,197 km and a total of 1,582 sections. Figure 3 Upper boundary: The hydrodynamic model takes the flow process of Taocha Canal Head Regulating Gate in 2018 as the inflow boundary, as shown in Figure 4 Lower boundary: The hydrodynamic model takes the water level process of the North Juma River Regulating Gate in 2018 as the downstream boundary, as shown in Figure 5 As shown. Initial conditions: The flow rate of the Taocha Canal Head Regulating Gate and the water level of the Taocha Canal Head Regulating Gate on January 1, 2018 are used as the initial conditions of the model. Inner boundary: There are 61 regulating gates along the Taocha Canal Head to the North Juma River section, and the gate type is a radial gate. Source and sink terms: The flow process of the diversion gate and the water discharge gate in 2018 is used as the source and sink terms. There are 74 diversion gates and 53 water discharge gates in the Taocha to North Juma River section.

[0127] The simulation results of water level before and after the gate and flow through the gate of some control gates are as follows Figure 6 It can be seen that the average relative error between the simulated and measured water levels before and after each control sluice gate is less than 0.05%, and the average relative error of the flow through the sluice gate is less than 5%, indicating a good simulation effect.

[0128] The upper boundary of the water quality model uses the measured water quality data of Taocha in 2018, such as Figure 7 A water quality model is constructed based on the one-dimensional hydrodynamic model, and the model is calibrated and verified using the measured water quality data along the section (such as Chenggou). Figure 8 shown.

[0129] Step 3: Construct an open channel non-mechanism model: Since the research object selected in this embodiment is a water diversion project, the future flow of the Taocha section is determined by the engineering scheduling regulations. Therefore, in this embodiment, there is no need to use the LSTM model to predict the flow, and only the LSTM model is used to predict the water quality. For the Taocha section, an LSTM model is constructed, and the LSTM model is verified using the measured water quality data from 2017 to 2021. The results are as follows: Fig. 9As shown, the average relative errors of the predictions of permanganate index, total nitrogen, total phosphorus and ammonia nitrogen were 0.56%, 0.40%, 2.01% and 0.06%, respectively, indicating that the prediction effect was ideal.

[0130] Step 4: Predict the water quality of the open channel: This example uses the middle line of the South-to-North Water Diversion Project as an example, and uses the LSTM model that has been calibrated and verified to predict the water quality data of Taocha in the next 7 days (i.e., January 1-7, 2022). It is used as the upper boundary of the one-dimensional hydrodynamic and water quality model to predict the spatiotemporal distribution of water quality along the main canal of the middle line in the next 7 days. The comparison results of the water quality simulation and actual measurement of the main sections along the route are shown in the figure below. Fig.10 As shown in the figure, it can be seen that the average accuracy of water quality index prediction for main sections reaches 91%.

[0131] Finally, it should be noted that the above is only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred arrangement scheme, a person skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for predicting open channel water quality by coupling mechanism and non-mechanism model, characterized in that: The method comprises the following steps: Step 1, data collection: collect channel cross-section data of the open channel, historical hydrodynamic data, the location and historical flow data of the water outlet and the water diversion outlet, the location of the regulating gate and the historical measured gate opening, the water level before the gate and the water level after the gate, and historical water quality data; the historical hydrodynamic data include the upper boundary flow and water level, and the lower boundary water level data; the historical water quality data include the upper boundary water quality data and the water quality data of the water quality monitoring points along the line, and the water quality data are the permanganate index, total nitrogen, total phosphorus, and ammonia nitrogen concentration data; Step 2: Construct an open channel mechanism model: Based on the collected data, construct an open channel mechanism model, including a one-dimensional hydrodynamic model and a one-dimensional water quality model; Step 3: Construct an open channel non-mechanism model: Construct an LSTM model to extract internal rules from the historical flow and water quality data of the upper boundary, and use the advantages of the LSTM model's selective memory to predict the future short-term flow and water quality. That is, the collected historical flow and water quality data of the upper boundary are pre-processed and used as the input of the LSTM model, and the output is the flow and water quality data of the upper boundary in the short term in the future; Step 4. Predict the water quality of the open channel: Couple the one-dimensional hydrodynamic and water quality models with the LSTM model to predict the water quality of all sections of the open channel in the short term in the future. The preprocessed upper boundary historical flow and water quality data are used as the input of the LSTM model. The model output is the flow and water quality data of the upper boundary in the short term in the future. Then, the output of the LSTM model is used as the upper boundary condition of the one-dimensional hydrodynamic and water quality model to predict the water quality results of all sections along the open channel in the short term in the future.

2. The open channel water quality prediction method of a coupling mechanism and non-mechanism model according to claim 1 is characterized in that: The data collected in step 1 are obtained through automatic monitoring stations and supplementary collection through on-site monitoring; the collected upper boundary flow and upper boundary water quality data are long series data with a time length of no less than 5 years; the time length of other historical data is no less than 1 year.

3. The open channel water quality prediction method of a coupling mechanism and non-mechanism model according to claim 1 is characterized in that: The specific process of constructing the one-dimensional hydrodynamic model described in step 2 is as follows: first, interpolate the terrain elevation based on the large-section data of the channel, then set the upper boundary and lower boundary conditions according to the upper boundary flow and water level, and lower boundary water level data respectively, set the initial conditions according to the upper boundary initial flow and the upper boundary initial water level, that is, the flow and water level at the beginning, then set the source and sink terms according to the location and historical flow of the water outlet and the water diversion outlet, and set the inner boundary conditions based on the location of the control gate and the historical measured gate opening; The Saint-Venant equations, including the mass conservation equation and the momentum conservation equation, are used to couple the gate flow control equation to achieve continuous simulation of the channel hydraulic response process. The two adjacent sections, namely section X L and section X R The river section between the two is taken as a control unit. The division of the control unit comprehensively considers the model simulation area, water flow characteristics, calculation efficiency and key physical process factors. The size and distribution of the control unit can capture the changes in flow characteristics. Then the mass conservation equation is: Where: Q is the upper boundary flow, m 3 / s; A is the cross-sectional area of ​​water flow, m 2 ; I is the lateral inflow flow, including the flow of the water outlet and the water diversion outlet, m 3 / s; x is the length of the river section, m; t is the time, s; x L is the upstream boundary position of the control unit, m; x R is the downstream boundary position of the control unit, m; t D Calculate the starting time for the control unit, s; t U t D The time corresponding to the next time step, s; The momentum conservation equation is: Where: β is the momentum-flow correction coefficient, dimensionless; V is the volume of the control body, m 3 ; g is the acceleration due to gravity, m / s 2 ; J is the initial cross-sectional area, m 2 ; is the correction value of J, dimensionless; S0 is the bottom slope, %; S f is the friction slope, dimensionless; C D (w) ρ a U 2 is the wind-induced shear pressure, N·s / m 3 ; C D (w) is the wind-induced shear pressure coefficient, dimensionless; U is wind speed; ρ a is the wind density, kg / m 3 ; ρ is water density, kg / m 3 ; ψ is the angle between the downstream flow direction and the wind direction, degree; T is the water surface width, m; The gate overcurrent control equation is: For the gated flow channel section, the water flow meets the continuity condition at any time. Assuming that the flow rate of the section before the control gate is equal to the flow rate of the section after the control gate, the following formula is obtained: In the formula, Q gz is the flow rate through the gate, m 3 / s,Q gz =Q+I; the variable superscript indicates the calculation time, i.e. j+1 indicates the j+1 time; the variable subscript indicates the section number, i.e. i indicates the i-th section; When regulating water flow, the water flow state at the control gate is weir flow or gate hole outflow. According to whether the downstream water level affects the flow capacity, it is divided into gate hole free outflow, gate hole submerged outflow, weir flow free outflow and weir flow submerged outflow; According to the criteria for distinguishing weir flow and gate hole outflow, when e / H i When ≤0.65, the flow rate under the gate should be calculated according to the gate hole outflow formula: when When , the gate hole is free outflow: when When , the gate hole is submerged outflow: Where, b is the gate hole width, m; e is the gate hole opening, m; H i is the water depth of the section, m; is the water depth downstream of the gate at the time of calculation, m; is the water depth of the contraction section at the time of calculation, m; ε j+1 is the lateral contraction coefficient of the gate at the time of calculation, dimensionless; φ is the velocity coefficient, dimensionless; μ is the free outflow coefficient of the wide crested weir gate hole, dimensionless; σ s is the flooded outflow coefficient of the gate hole, dimensionless; is the total head of the section including the velocity head at the time of calculation, m; According to the criteria for distinguishing weir flow and gate hole outflow, when e / H i When >0.65, the weir flow formula is used for calculation: when When , the weir flow submerges the outflow: when When , it is the free outflow of weir flow: In the formula, The depth of water behind the gate when the downstream water level exceeds the weir crest at the calculation time, m; is the water depth of the downstream section at the time of calculation, m; z s is the elevation of the weir bottom, m; μ is the overflow coefficient, dimensionless; The flow rate Q is the gate opening e and the upstream water level. and downstream water level The function of m 3 / s.

4. The open channel water quality prediction method of a coupling mechanism and non-mechanism model according to claim 3 is characterized in that: The specific process of constructing the one-dimensional water quality model described in step 2 is: based on the upper boundary water quality data, the water quality boundary is set, and a one-dimensional water quality model is constructed on the basis of the one-dimensional hydrodynamic model, that is, on the basis of the flow and water level calculated by the St. Vincent South steady flow model, the convection diffusion, dilution, self-reaction of water quality components, interaction between water quality components, and the influence of external sources and sinks of components on component concentrations of water quality indicators in the water body are considered to establish a one-dimensional mathematical model to describe water quality. For a certain concentration c i The equilibrium equation of water quality index between section i-1 and section i is: Where: c i is the water quality index concentration, mg / L; Q i-1 is the inflow flow rate of section i-1, m 3 / s;Q i is the outflow rate of section i, m 3 / s;Q out is the water intake flow between section i-1 and section i, m 3 / s; V i is the volume between section i-1 and section i, m 3 ; E i ' and E i-1 ' are the diffusion coefficients of section i and section i-1, respectively, m 3 / d;W i is the exogenous input, mg / d; t is the time, s; k is the first-order degradation coefficient of the substance calculated by simulation, d -1 ; The model parameters are calibrated using water quality data from water quality monitoring sections along the route, so that the error between the simulated water quality results and the measured values ​​at the sections along the route is within the allowable error range.

5. The open channel water quality prediction method of a coupling mechanism and non-mechanism model according to claim 1 is characterized in that: The specific process of building the LSTM model in step 3 is as follows: the LSTM model is a time recursive neural network model. The LSTM model selectively retains information through a gating mechanism. There are three gates in the LSTM unit, namely the input gate, the forget gate, and the output gate. The input gate determines which new information is stored in the unit state; the forget gate controls the internal state C of the previous time. t-1 How much information needs to be forgotten; the output gate controls the internal state C at the current moment t How much information needs to be output to the external state h t , the calculation formula is as follows: i t =σ(w i [x t ,h t-1 +b i ]) (9) f t =σ(w f [x t, h t-1 +b f ]) (10) the t =σ(w o [x] t, h t-1 +b o ]) (11) In the formula, σ() is the Sigmoid activation function, with a value between [0,1], indicating the weight of letting information pass through, i t is the output of the input gate; w i is the weight matrix of the input gate; f t is the output of the forget gate; w f is the weight matrix of the forget gate; o t is the output of the output gate, w o is the weight matrix of the output gate; Preprocess the collected upper boundary historical flow and water quality data, including missing value processing, data slicing, and data normalization, to ensure data quality and availability; The preprocessed data is used as training data to train the model, and the model prediction results are verified. If the prediction error is within 5%, it indicates that the prediction effect is ideal, that is, the model training is completed.

6. The open channel water quality prediction method of coupling mechanism and non-mechanism model according to claim 5 is characterized in that: The missing value processing is: Lagrange interpolation and piecewise linear interpolation are used in combination. The specific formula is as follows: Where: x k is a missing value, x i and x j They are missing value base data and non-base data, For x k Interpolation results of missing values; In order to avoid oscillation of Lagrange interpolation due to too large an interpolation range, the piecewise interpolation method is combined in a small range and adjusted according to the measured data to ensure compliance with the law; The data slicing is as follows: determining the time step of input and output data during the training of the LSTM model; dividing the training set and the test set into 7:3, i.e., 70% for the training set and 30% for the test set; slicing the data in the form of a sliding window to determine the optimal window value; x t+1 =F(x t-n ,x t-n+1 ,…,x t ) (14) In the formula [x t-n , x t-n+1 ,…,x t ] is used as input, which is a sliding window in the whole training process. The data of fixed time length passes through this window to train the time series model; x t+1 As input; n is the data time length; The data normalization process is: using the min-max standardization method to normalize the data, the formula is as follows: Where x is the original sample data; min(x) and max(x) are the minimum and maximum values ​​of the original sample data, respectively.

7. The open channel water quality prediction method of coupling mechanism and non-mechanism model according to claim 1 is characterized in that: The specific process of coupling the one-dimensional hydrodynamic and water quality models with the LSTM model described in step 4 is as follows: integrating the LSTM model with the one-dimensional hydrodynamic and water quality models through the Fortran language, that is, linking the flow and water quality data of the upper boundary output of the LSTM model in the short term in the future to the boundary conditions of the one-dimensional hydrodynamic and water quality models, and predicting the water quality of each section of the open channel in the short term in the future. During the prediction process, it is necessary to set the number of iterations n_estimators, the maximum depth of the tree max_depth, the learning rate learning_rate, the minimum shunt loss min_gamma, and the minimum leaf node sample weight sum min_child_weight. During the prediction process, the initial value of the learning rate is set to 0.1, and the grid search method is used to first optimize the number of iterations and the maximum depth of the tree, and then the grid search method is continued to be used to optimize the learning rate parameters, and finally the minimum shunt loss and the minimum leaf node sample weight parameters are set.

Citation Information

Patent Citations

  • Drainage basin water quality short-term prediction method based on improved LSTM

    CN114386686A

  • River monitoring section water quality prediction method

    CN115526378A

  • River water quality and quantity prediction method based on urban water system model interaction

    CN117610208A

  • Method and system for constructing flood discharge safety knowledge graph by combining machine learning with traditional mechanism model

    CN117993495A

  • Water transfer project water quality prediction method based on SVR coupling mechanism model

    CN118094323A

Cited By

  • River hydrodynamic force and pollutant migration collaborative prediction method based on coupling model

    CN120725229A