River flow real-time simulation and prediction system based on digital twinning

By combining the Saint-Venant equations and data assimilation techniques, a hydrodynamic digital twin model driven by water level difference was constructed, and a state switching layer driven by deviation was added. This solved the problems of accuracy and stability in river flow prediction under extreme conditions, and achieved high-precision, long-term reliable prediction and intelligent early warning.

CN121543501APending Publication Date: 2026-02-17QINGDAO YIHE XINSHUI TECHNOLOGY CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511731836.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Existing methods for predicting river flow are inaccurate under extreme weather or human intervention, have difficulty utilizing multi-source heterogeneous data, and lack sufficient prediction accuracy and timeliness. Furthermore, they lack assessment of model uncertainty, which affects the reliability and usability of prediction results.

Method used

We employ a hydrodynamic digital twin model based on the Saint-Venant equations, combined with a Seq2Seq-Attention model that incorporates data assimilation parameter correction and improvement. We also add a bias-driven state switching layer to achieve adaptive prediction driven by multi-source data.

Benefits of technology

It improves the accuracy and stability of river flow forecasting, maintains high-precision forecasting under extreme conditions, and enhances the scientific nature and timeliness of flood warning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121543501A_ABST
    Figure CN121543501A_ABST
Patent Text Reader

Abstract

The invention discloses a real-time simulation and prediction system for river water flow based on digital twinning, and the system comprises the following modules: a multi-source data synchronous collection module which is used for constructing a core hydrological data flow; the data preprocessing module is used for outputting a core driving data stream; the hydrodynamic digital twinning construction module is used for establishing a water level difference driven twinning model; the real-time simulation and assimilation calibration module is used for performing real-time calculation by taking the core driving data flow as a boundary condition and outputting a real-time simulation twin body; the intelligent rolling prediction module is used for generating a multi-section prediction sequence by utilizing an improved Seq2Seq-Attention model based on the real-time simulated twinborn body and the core driving data stream; and the visualization and early warning output module is used for presenting the prediction result and triggering early warning. According to the method, a physical mechanism and a data model are fused, and through dynamic calibration and self-adaptive prediction, the precision, the stability and the prediction period of river flow prediction are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of digital twins and big data analytics, and in particular to a real-time simulation and prediction system for river flow based on digital twins. Background Technology

[0002] Digital twin technology, with its ability to map physical entities in virtual space and enable real-time interaction, has been widely applied in smart cities, intelligent manufacturing, water conservancy and hydrology in recent years, becoming an important development direction for achieving refined system management and forward-looking decision-making. However, in practical applications, river flow prediction scenarios face many challenges, such as large deviations between physical models and actual conditions, complex coupling of external driving factors, and high requirements for prediction accuracy and timeliness. The deployment effectiveness of digital twin technology is still constrained by many factors.

[0003] Most current river forecasting methods rely on a single hydrodynamic physical model, which fails to fully utilize the complex influence of multi-source heterogeneous data such as rainfall, evaporation, and upstream inflow on flow evolution. This leads to inaccurate predictions under extreme weather conditions or human intervention. Some systems only use open-loop model calculations, ignoring the real-time feedback correction of key parameters by measured water level data, thus limiting the model's ability to track dynamic changes in river conditions. Furthermore, the rigid predictive logic of purely physical models makes it difficult to provide managers with quantitative assessments of model uncertainty or confidence levels, affecting the reliability and usability of the prediction results.

[0004] Furthermore, the input-output relationships of existing data-driven models in river prediction are mostly statically designed, failing to dynamically adjust the prediction strategy according to the calibration status of the physical model. This results in poor robustness of the prediction results during periods when the physical model is inaccurate, making it unable to adapt to the continuous changes and evolution of the river flow system, which seriously affects the practical value and stability of the model in real flood control and early warning scenarios.

[0005] Therefore, how to provide a patient continuous health management system based on reinforcement learning strategy optimization is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0006] One objective of this invention is to propose a real-time simulation and prediction system for river flow based on digital twins. This invention fully integrates key steps such as hydrodynamic modeling based on the Saint-Venant equations, data assimilation parameter correction, and improved Seq2Seq-Attention model rolling prediction. It constructs an intelligent river flow prediction process with physical constraint guarantees, multi-source data-driven operation, and adaptive prediction modes. The core improvement of the improved Seq2Seq-Attention model lies in the addition of a bias-driven state switching layer. This layer dynamically selects a standard or conservative prediction mode based on the calibration bias of the physical model, achieving accurate synchronization and robust prediction of flow states under complex hydrological environments. This invention possesses advantages such as deep integration of physical mechanisms and data models, strong adaptability of prediction strategies, and good robustness of prediction results. It can significantly improve prediction accuracy and model stability under abnormal conditions, thereby effectively solving problems such as poor adaptability of pure physical models, lack of physical interpretation in pure data models, and single prediction strategies in existing methods.

[0007] A real-time simulation and prediction system for river flow based on digital twins according to an embodiment of the present invention includes the following modules:

[0008] The multi-source data synchronous acquisition module is used to synchronously acquire multi-source data from the river channel and construct the core hydrological data stream;

[0009] The data preprocessing module is used to preprocess the core hydrological data stream and output the core driving data stream;

[0010] The hydrodynamic digital twin construction module is used to build a hydrodynamic digital twin model driven by water level difference based on the Saint-Venant equations, calculate the changes in water flow in the river channel, and output the water level difference driven twin model.

[0011] The real-time simulation and assimilation calibration module is used to input the core driving data stream as boundary conditions into the water level difference driven twin model for real-time calculation, invert and update the corrected channel roughness parameters in real time, and output the real-time simulation twin.

[0012] The intelligent rolling prediction module is used to predict the water level and flow sequence of downstream sections within a future time window based on real-time simulation twins and core driving data flow, and to generate multi-section prediction sequences.

[0013] The visualization and early warning output module is used to present the multi-section prediction sequence on the digital twin platform and automatically trigger the early warning mechanism when the predicted water level or flow exceeds the preset safety threshold.

[0014] Optionally, modules can be integrated using the following methods:

[0015] S1. Simultaneously collect multi-source data from the river channel to construct a core hydrological data stream;

[0016] S2. Preprocess the core hydrological data stream and output the core driving data stream;

[0017] S3. Based on the Saint-Venant equations, establish a hydrodynamic digital twin model driven by water level difference, calculate the change in water flow in the river channel, and output the water level difference driven twin model.

[0018] S4. Input the core driving data stream as boundary conditions into the water level difference driven twin model for real-time calculation, invert and update the corrected channel roughness parameters in real time, and output a real-time simulation twin that is synchronized with the real channel state.

[0019] S5. Based on real-time simulation twins and core driving data flow, the improved Seq2Seq-Attention model is used to predict the water level and flow sequence of downstream sections in future time windows, generating multi-section prediction sequences.

[0020] S6. Present the multi-section prediction sequence on the digital twin platform, and automatically trigger the early warning mechanism when the predicted water level or flow exceeds the preset safety threshold.

[0021] Optionally, S1 specifically includes:

[0022] S11. Simultaneously trigger the flow sensors deployed at the upstream and downstream sections of the river channel, the rain gauges deployed in the basin, the evaporation sensors deployed at the meteorological station, and the water level sensors deployed at the upstream and downstream sections to collect multi-source data on upstream section flow, downstream section flow, rainfall, evaporation, upstream section real-time water level, and downstream section real-time water level, respectively.

[0023] S12. For the collected multi-source data, timestamps are aligned based on Coordinated Universal Time (UTC), and geographic coordinates are registered using a unified geospatial coordinate system to construct the core hydrological data stream.

[0024] Optionally, S2 specifically includes:

[0025] S21. Read the upstream and downstream cross-sectional flow corresponding to the same timestamp in the core hydrological data stream, calculate the difference to obtain the interval flow difference, and multiply the rainfall in the watershed corresponding to the timestamp by the preset unit conversion factor to convert it into the interval theoretical runoff increment.

[0026] S22. Compare the interval flow difference with the interval theoretical runoff increment. When the absolute value of the interval flow difference exceeds the preset error threshold range of the interval theoretical runoff increment, determine that the upstream and downstream cross-sectional flow of the timestamp are abnormal data points and remove them from the core hydrological data stream.

[0027] S23. Traverse the core hydrological data stream, identify continuous missing data segments caused by data removal operations, locate the previous valid data point of the start time point and the next valid data point of the end time point for each missing data segment, use a linear interpolation algorithm to calculate the interpolated data value corresponding to each interpolation time point, fill all the interpolated data values ​​into the missing data segment, and output the core driving data stream.

[0028] Optionally, S3 specifically includes:

[0029] S31. Based on the Saint-Venant equations, establish the governing equations for describing one-dimensional unsteady flow, consisting of the continuity equation and the motion equations after specific simplification.

[0030] S32. The calculation steps of the continuity equation include calculating the rate of change of the upstream and downstream cross-sectional areas with time, and simultaneously calculating the rate of change of the river flow along the direction of water flow. The two rates of change are added together and the result is set to zero, indicating that in any small section of the river, the sum of the change in the upstream and downstream cross-sectional areas per unit time and the change in the flow per unit length of the river section is zero, which follows the law of conservation of mass.

[0031] S33. The calculation steps of the simplified motion equation include calculating the product of the upstream and downstream cross-sectional areas, the gravitational acceleration, and the rate of change of water level along the flow direction; calculating the product of the upstream and downstream cross-sectional areas, the gravitational acceleration, and the frictional drop; adding the two products together and setting the result to zero, indicating that the driving force of the river flow evolution comes from the rate of change of water level along the flow direction, that is, the real-time water level difference between the upstream and downstream cross-sections, and the driving force and the riverbed frictional resistance reach instantaneous equilibrium.

[0032] S34. The continuity equation is combined with the motion equation after a specific simplification. The real-time water level difference between the upstream and downstream sections is taken as the dominant driving force for the evolution of the water flow. The friction ratio is expressed parametrically using the Manning formula. A water level difference driven twin model is constructed with water level difference as input, downstream flow change as output, and channel roughness parameter as the key parameter to be calibrated.

[0033] Optionally, the Manning formula specifically includes: calculating the product of the square of the channel roughness parameter and the square of the channel flow rate, calculating the product of the square of the cross-sectional area of ​​the water passage and the cube of the radius of the water surface, and dividing the first product by the second product to obtain the value of the friction ratio.

[0034] Optionally, S4 specifically includes:

[0035] S41. Read the upstream cross-section flow, rainfall in the basin and evaporation at the meteorological station at the current time step from the core driving data stream, and use them as boundary conditions to input into the water level difference driven twin model to perform real-time calculation of water flow evolution. The calculation process only considers the upstream inflow drive and ignores the direct impact of rainfall and evaporation on the river water volume. After the calculation is completed, the initial predicted water level of the downstream cross-section is output.

[0036] S42. Independently calculate the net change in river water volume caused by rainfall and evaporation, read the rainfall in the basin at the current time step, multiply the rainfall by the preset unit conversion factor, and obtain the increase in runoff into the river per unit time.

[0037] S43. Read the evaporation amount at the current time step, multiply the evaporation amount by the current river surface area, multiply by the preset unit conversion factor to obtain the runoff reduction from the river evaporation per unit time, subtract the runoff reduction from the runoff increase to obtain the net change in river water volume at the current time step.

[0038] S44. Based on the change in net river water volume, the initial predicted water level of the downstream section is compensated and corrected. The change in net river water volume at the current time step is multiplied by the calculation time step to obtain the total volume change within the time step. This volume is then divided by the upstream and downstream cross-sectional areas of the downstream section to obtain the water level compensation value. The water level compensation value is added to the initial predicted water level of the downstream section to generate the theoretical water level of the downstream section.

[0039] S45. Read the measured water level of the downstream section that precisely corresponds to the current calculation time step from the core drive data stream, use it as a feedback calibration signal, subtract the theoretical water level from the measured water level of the downstream section, and calculate the water level deviation value of the current time step.

[0040] S46. Based on the water level deviation value, the corrected river roughness parameter is inverted and output in real time. The preset sensitivity analysis matrix for data assimilation is retrieved. The sensitivity analysis matrix stores the partial derivative relationship between water level change and river roughness parameter change.

[0041] S47. Input the water level deviation value at the current time step into the sensitivity analysis matrix. Calculate the correction amount of the channel roughness parameter required to bring the water level deviation value close to zero through matrix multiplication. Read the channel roughness parameter value currently in use in the water level difference driven twin model and algebraically add it to the correction amount to obtain the corrected channel roughness parameter.

[0042] S48. Write the corrected channel roughness parameters to the parameter storage area of ​​the water level difference driven twin model in real time through the data interface and update it. Based on the updated water level difference driven twin model state and parameters, output the real-time simulation twin.

[0043] Optionally, S5 specifically includes:

[0044] S51. Taking the real-time simulation twin as the starting point, set the time window length, and extract the upstream cross-section flow, rainfall, evaporation, upstream cross-section real-time water level and downstream cross-section real-time water level of each hour in chronological order from the core driving data stream to form multivariate time series data.

[0045] S52. The current downstream section water level and flow rate in the real-time simulation twin are used as the current state data. The multivariate time series data and the current state data are concatenated according to the feature dimension to obtain the input matrix of the improved Seq2Seq-Attention model.

[0046] S53. Input the input matrix into the encoder of the improved Seq2Seq-Attention model in the order of time steps. Perform linear transformation and non-linear activation through the preset activation function and weight matrix to calculate the hidden state of the current time step. Output the hidden states of all time steps to form the encoder hidden state sequence.

[0047] S54. A deviation-driven state switching layer is added. A state switching threshold is set. The absolute value of the water level deviation value at the current time step is read and compared with the state switching threshold. When the absolute value of the deviation value is less than or equal to the state switching threshold, it is determined that the current calibration accuracy is high. The standard prediction mode is selected and the encoder hidden state sequence is directly used as the input of the decoder.

[0048] S55. When the absolute value of the deviation is greater than the state switching threshold, it is determined that the current calibration accuracy is low, and the conservative prediction mode is started. A preset attenuation coefficient less than 1 is applied to each vector in the encoder hidden state sequence to perform element-wise numerical scaling. The scaled encoder hidden state sequence is used as the input of the decoder.

[0049] S56. Perform a dot product operation between the hidden state of the decoder at the previous time step and each vector in the hidden state sequence of the encoder to obtain the original alignment score. Normalize all the original alignment scores through the Softmax function to obtain the attention weight vector.

[0050] S57. The attention weight vector and the encoder hidden state sequence are weighted and summed to generate the context vector of the current time step. This context vector is then concatenated with the input of the decoder at the current time step and fed into the recurrent neural network of the decoder. Linear transformation and nonlinear activation are performed through the preset activation function and weight matrix to calculate the predicted water level and flow rate at the current time step and update the hidden state of the decoder.

[0051] S58. Arrange the predicted water level and flow data of each time step output by the decoder in chronological order according to the timestamp to construct a multi-section prediction sequence.

[0052] Optionally, S6 specifically includes: visually rendering the multi-section prediction sequence on a digital twin platform, presenting it in the form of dynamic evolution curves and three-dimensional water flow patterns, and automatically triggering an early warning mechanism to output and push early warning information when the predicted water level or flow exceeds a preset safety threshold.

[0053] The beneficial effects of this invention are:

[0054] First, by integrating the Saint-Venant equations with a data assimilation algorithm, a real-time simulation twin driven by water level difference was constructed, which effectively restored the physical laws of river flow evolution. Furthermore, key roughness parameters were corrected in real time through actual water level feedback, providing a dynamic foundation for high-precision prediction that is synchronized with the real physical world.

[0055] Secondly, a rolling prediction of future water flow states is achieved based on an improved Seq2Seq-Attention model. The core of the improved Seq2Seq-Attention model lies in the addition of a bias-driven state switching layer. This layer can dynamically select a standard or conservative prediction mode based on the calibration deviation of the physical model, enhancing the model's robustness under conditions of physical model inaccuracy. During the prediction process, the model uses the real-time simulated twin state as the input starting point, ensuring the physical rationality and continuity of the prediction sequence. The improved Seq2Seq-Attention model significantly improves the predictive model's adaptability, boundary condition adaptability, and result stability, effectively addressing the prediction accuracy degradation problem under complex scenarios such as extreme weather and human intervention, thereby enhancing the practical value of the entire system in real flood prevention and early warning.

[0056] Furthermore, during real-time forecasting, the system can visualize and render multi-section forecast sequences on a digital twin platform and automatically trigger early warning mechanisms, providing managers with intuitive and timely decision support. During system operation, it continuously collects new hydrological and model performance data, providing a data foundation for continuous model optimization and iteration, and enhancing the model's generalization ability and adaptability in long-term operation.

[0057] In summary, this invention, by integrating physical models, data assimilation, and improved deep learning models, can significantly improve the accuracy, stability, and intelligence level of river flow prediction, providing reliable technical support for smart water conservancy. Attached Figure Description

[0058] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0059] Figure 1 This is a structural diagram of a real-time simulation and prediction system for river flow based on digital twins proposed in this invention.

[0060] Figure 2 This is a flowchart illustrating the construction and data assimilation calibration process of the hydrodynamic digital twin model based on the Saint-Venant equations proposed in this invention.

[0061] Figure 3 This is a flowchart of the prediction process for the improved Seq2Seq-Attention model based on deviation-driven state switching proposed in this invention. Detailed Implementation

[0062] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0063] refer to Figures 1-3 A real-time simulation and prediction system for river flow based on digital twins includes the following modules:

[0064] The multi-source data synchronous acquisition module is used to synchronously acquire multi-source data from the river channel and construct the core hydrological data stream;

[0065] The data preprocessing module is used to preprocess the core hydrological data stream and output the core driving data stream;

[0066] The hydrodynamic digital twin construction module is used to build a hydrodynamic digital twin model driven by water level difference based on the Saint-Venant equations, calculate the changes in water flow in the river channel, and output the water level difference driven twin model.

[0067] The real-time simulation and assimilation calibration module is used to input the core driving data stream as boundary conditions into the water level difference driven twin model for real-time calculation, invert and update the corrected channel roughness parameters in real time, and output the real-time simulation twin.

[0068] The intelligent rolling prediction module is used to predict the water level and flow sequence of downstream sections within a future time window based on real-time simulation twins and core driving data flow, and to generate multi-section prediction sequences.

[0069] The visualization and early warning output module is used to present the multi-section prediction sequence on the digital twin platform and automatically trigger the early warning mechanism when the predicted water level or flow exceeds the preset safety threshold.

[0070] In this embodiment, the modules are interconnected using the following method:

[0071] S1. Simultaneously collect the flow rate at upstream and downstream sections of the river, the rainfall in the basin, the evaporation at the meteorological station, and the real-time water level at upstream and downstream sections, and unify them to the same time reference and geospatial coordinate system to construct the core hydrological data stream.

[0072] S2. Preprocess the core hydrological data stream, use the principle of flow balance between upstream and downstream sections as physical constraints to identify and remove abnormal data points, and use interpolation algorithms to repair missing data segments, outputting the core driving data stream.

[0073] S3. Based on the Saint-Venant equations, establish a water level difference-driven hydrodynamic digital twin model, take the real-time water level difference between the upstream and downstream sections as the dominant driving force for the evolution of water flow, calculate the change in water flow in the river channel, and output the water level difference-driven twin model.

[0074] S4. Input the core driving data stream as boundary conditions into the water level difference driven twin model for real-time calculation to obtain the initial predicted water level of the downstream section. Independently calculate the net change in river water volume caused by rainfall and evaporation, and compensate for the theoretical water level change of the downstream section based on this net water volume. Use the measured water level of the downstream section as a feedback calibration signal. Through the data assimilation algorithm, compare the deviation between the theoretical water level after water volume compensation and the measured water level. Real-time inversion and output of the corrected river roughness parameters. Update the corrected river roughness parameters to the water level difference driven twin model in real time and output a real-time simulation twin synchronized with the real river state.

[0075] S5. Based on real-time simulation twins and core driving data flow, the improved Seq2Seq-Attention model is used to predict the water level and flow sequence of downstream sections in future time windows, generating multi-section prediction sequences.

[0076] S6. Present the multi-section prediction sequence on the digital twin platform, and automatically trigger the early warning mechanism when the predicted water level or flow exceeds the preset safety threshold, outputting and pushing early warning information.

[0077] This implementation significantly improves the accuracy and lead time of river flow prediction. By constructing a hydrodynamic digital twin model driven by water level difference and integrating multi-source data such as rainfall and evaporation, accurate simulation of the physical processes of water flow is achieved. Crucially, real-time feedback using downstream measured water levels and dynamic calibration of roughness parameters through data assimilation ensure close synchronization between the simulated twin and the real river channel. Furthermore, the improved Seq2Seq-Attention model adaptively handles physical model biases, effectively extending the effective lead time and ensuring the stability of long-term predictions. Ultimately, this method achieves high-precision, long-lead-time rolling predictions and intelligent early warning, significantly enhancing the scientific rigor and timeliness of flood control decision-making.

[0078] In this embodiment, S1 specifically includes:

[0079] S11. Simultaneously trigger the flow sensors deployed at the upstream and downstream sections of the river channel, the rain gauges deployed in the basin, the evaporation sensors deployed at the meteorological station, and the water level sensors deployed at the upstream and downstream sections to collect multi-source data on upstream section flow, downstream section flow, rainfall, evaporation, upstream section real-time water level, and downstream section real-time water level, respectively.

[0080] S12. For the collected multi-source data, timestamps are aligned based on Coordinated Universal Time (UTC), and geographic coordinates are registered using a unified geospatial coordinate system to construct the core hydrological data stream.

[0081] In this embodiment, S2 specifically includes:

[0082] S21. Read the upstream and downstream cross-sectional flow corresponding to the same timestamp in the core hydrological data stream, calculate the difference to obtain the interval flow difference, and multiply the rainfall in the watershed corresponding to the timestamp by the preset unit conversion factor to convert it into the interval theoretical runoff increment.

[0083] S22. Compare the interval flow difference with the interval theoretical runoff increment. When the absolute value of the interval flow difference exceeds the preset error threshold range of the interval theoretical runoff increment, determine that the upstream and downstream cross-sectional flow of the timestamp are abnormal data points and remove them from the core hydrological data stream.

[0084] S23. Traverse the core hydrological data stream, identify continuous missing data segments caused by data removal operations, locate the previous valid data point of the start time point and the next valid data point of the end time point for each missing data segment, use a linear interpolation algorithm to calculate the interpolated data value corresponding to each interpolation time point, fill all the interpolated data values ​​into the missing data segment, and output the core driving data stream.

[0085] In this embodiment, S3 specifically includes:

[0086] S31. Based on the Saint-Venant equations, establish the governing equations for describing one-dimensional unsteady flow, consisting of the continuity equation and the motion equations after specific simplification.

[0087] S32. The calculation steps of the continuity equation include calculating the rate of change of the upstream and downstream cross-sectional areas with time, and simultaneously calculating the rate of change of the river flow along the direction of water flow. The two rates of change are added together and the result is set to zero, indicating that in any small section of the river, the sum of the change in the upstream and downstream cross-sectional areas per unit time and the change in the flow per unit length of the river section is zero, which follows the law of conservation of mass.

[0088] S33. The calculation steps of the simplified motion equation include calculating the product of the upstream and downstream cross-sectional areas, the gravitational acceleration, and the rate of change of water level along the flow direction; calculating the product of the upstream and downstream cross-sectional areas, the gravitational acceleration, and the frictional drop; adding the two products together and setting the result to zero, indicating that the driving force of the river flow evolution comes from the rate of change of water level along the flow direction, that is, the real-time water level difference between the upstream and downstream cross-sections, and the driving force and the riverbed frictional resistance reach instantaneous equilibrium.

[0089] S34. The continuity equation is combined with the motion equation after a specific simplification. The real-time water level difference between the upstream and downstream sections is taken as the dominant driving force for the evolution of the water flow. The friction ratio is expressed parametrically using the Manning formula. A water level difference driven twin model is constructed with water level difference as input, downstream flow change as output, and channel roughness parameter as the key parameter to be calibrated.

[0090] In this embodiment, the Manning formula specifically includes: calculating the product of the square of the channel roughness parameter and the square of the channel flow rate, calculating the product of the square of the cross-sectional area of ​​the water passage and the cube of the radius of the water surface, and dividing the first product by the second product to obtain the value of the friction ratio.

[0091] This implementation method achieves a precise mathematical description of the physical processes of river flow by constructing a hydrodynamic digital twin model driven by water level difference. Based on the Saint-Venant equations, this method combines the continuity equation with a simplified equation of motion, creatively establishing the real-time water level difference between upstream and downstream as the dominant driving force for flow evolution, and parameterizing the friction gradient using the Manning formula. This modeling approach not only strictly adheres to the physical laws of mass conservation and instantaneous dynamic balance, but also transforms the complex problem of river roughness into a dynamically calibrable key parameter. The model constructed in this way has a clear structure and explicit physical meaning, laying a solid theoretical foundation for subsequent real-time calibration through data assimilation and achieving synchronization between the simulated twin and the real river state, significantly improving the simulation accuracy and interpretability of the model.

[0092] In this embodiment, S4 specifically includes:

[0093] S41. Read the upstream cross-section flow, rainfall in the basin and evaporation at the meteorological station at the current time step from the core driving data stream, and use them as boundary conditions to input into the water level difference driven twin model to perform real-time calculation of water flow evolution. The calculation process only considers the upstream inflow drive and ignores the direct impact of rainfall and evaporation on the river water volume. After the calculation is completed, the initial predicted water level of the downstream cross-section is output.

[0094] S42. Independently calculate the net change in river water volume caused by rainfall and evaporation, read the rainfall in the basin at the current time step, multiply the rainfall by the preset unit conversion factor, and obtain the increase in runoff into the river per unit time.

[0095] S43. Read the evaporation amount at the current time step, multiply the evaporation amount by the current river surface area, multiply by the preset unit conversion factor to obtain the runoff reduction from the river evaporation per unit time, subtract the runoff reduction from the runoff increase to obtain the net change in river water volume at the current time step.

[0096] S44. Based on the change in net river water volume, the initial predicted water level of the downstream section is compensated and corrected. The change in net river water volume at the current time step is multiplied by the calculation time step to obtain the total volume change within the time step. This volume is then divided by the upstream and downstream cross-sectional areas of the downstream section to obtain the water level compensation value. The water level compensation value is added to the initial predicted water level of the downstream section to generate the theoretical water level of the downstream section.

[0097] S45. Read the measured water level of the downstream section that precisely corresponds to the current calculation time step from the core drive data stream, use it as a feedback calibration signal, subtract the theoretical water level from the measured water level of the downstream section, and calculate the water level deviation value of the current time step.

[0098] S46. Based on the water level deviation value, the corrected river roughness parameter is inverted and output in real time. The preset sensitivity analysis matrix for data assimilation is retrieved. The sensitivity analysis matrix stores the partial derivative relationship between water level change and river roughness parameter change.

[0099] S47. Input the water level deviation value at the current time step into the sensitivity analysis matrix. Calculate the correction amount of the channel roughness parameter required to bring the water level deviation value close to zero through matrix multiplication. Read the channel roughness parameter value currently in use in the water level difference driven twin model and algebraically add it to the correction amount to obtain the corrected channel roughness parameter.

[0100] S48. Write the corrected river roughness parameters to the parameter storage area of ​​the water level difference driven twin model in real time through the data interface and update it. Based on the updated water level difference driven twin model state and parameters, output a real-time simulation twin that is synchronized with the real river state.

[0101] This implementation method achieves real-time calibration and dynamic correction of the hydrodynamic digital twin model by introducing a data assimilation mechanism. The method uses the core driving data stream as boundary conditions for physical calculations and independently calculates the net water volume changes caused by factors such as rainfall and evaporation, compensating for the initial predicted water level and generating a theoretical water level that more closely reflects physical reality. Its core lies in using the measured water level at the downstream section as feedback, retrieving the precise correction amount of the river channel roughness parameter through a sensitivity analysis matrix, and updating it to the model in real time. This closed-loop feedback mechanism ensures that the simulation twin can continuously track the dynamic changes of the real river channel, effectively overcoming the model parameter drift problem caused by factors such as siltation and vegetation growth, significantly improving the synchronization accuracy between the simulation state and the actual river channel state, and providing high-fidelity input for subsequent rolling predictions.

[0102] In this embodiment, S5 specifically includes:

[0103] S51. Taking the real-time simulation twin as the starting point, set the time window length, and extract the upstream cross-section flow, rainfall, evaporation, upstream cross-section real-time water level and downstream cross-section real-time water level of each hour in chronological order from the core driving data stream to form multivariate time series data.

[0104] S52. The current downstream section water level and flow rate in the real-time simulation twin are used as the current state data. The multivariate time series data and the current state data are concatenated according to the feature dimension to obtain the input matrix of the improved Seq2Seq-Attention model.

[0105] S53. Input the input matrix into the encoder of the improved Seq2Seq-Attention model in the order of time steps. Perform linear transformation and non-linear activation through the preset activation function and weight matrix to calculate the hidden state of the current time step. Output the hidden states of all time steps to form the encoder hidden state sequence.

[0106] S54. A deviation-driven state switching layer is added. A state switching threshold is set. The absolute value of the water level deviation value at the current time step is read and compared with the state switching threshold. When the absolute value of the deviation value is less than or equal to the state switching threshold, it is determined that the current calibration accuracy is high. The standard prediction mode is selected and the encoder hidden state sequence is directly used as the input of the decoder.

[0107] S55. When the absolute value of the deviation is greater than the state switching threshold, it is determined that the current calibration accuracy is low, and the conservative prediction mode is started. A preset attenuation coefficient less than 1 is applied to each vector in the encoder hidden state sequence to perform element-wise numerical scaling. The scaled encoder hidden state sequence is used as the input of the decoder.

[0108] S56. Perform a dot product operation between the hidden state of the decoder at the previous time step and each vector in the hidden state sequence of the encoder to obtain the original alignment score. Normalize all the original alignment scores through the Softmax function to obtain the attention weight vector.

[0109] S57. The attention weight vector and the encoder hidden state sequence are weighted and summed to generate the context vector of the current time step. This context vector is then concatenated with the input of the decoder at the current time step and fed into the recurrent neural network of the decoder. Linear transformation and nonlinear activation are performed through the preset activation function and weight matrix to calculate the predicted water level and flow rate at the current time step and update the hidden state of the decoder.

[0110] S58. Arrange the predicted water level and flow data of each time step output by the decoder in chronological order according to the timestamp, and construct a multi-section prediction sequence with time as the row and cross-section and prediction variable as the column.

[0111] This implementation achieves adaptive prediction of the improved Seq2Seq-Attention model by introducing a deviation-driven state switching mechanism. The method fuses a real-time simulation twin with the core driving data stream to construct an input matrix, and extracts deep spatiotemporal features through an encoder. Its core innovation lies in the added state switching layer, which dynamically selects the prediction mode based on the real-time water level deviation: a standard mode is used to pursue accuracy when calibration accuracy is high, while a conservative mode is activated when calibration accuracy is low, suppressing error propagation by attenuating the weights of historical information. This adaptive mechanism effectively avoids prediction collapse when facing physical model inaccuracies or extreme hydrological events, significantly enhancing the robustness and stability of the prediction. Ultimately, this approach ensures the generation of high-precision, high-reliability multi-section prediction sequences under various complex operating conditions.

[0112] In this embodiment, S6 specifically includes: visually rendering the multi-section prediction sequence on a digital twin platform, presenting it in the form of dynamic evolution curves and three-dimensional water flow patterns, and automatically triggering an early warning mechanism when the predicted water level or flow exceeds a preset safety threshold, outputting and pushing early warning information.

[0113] Example 1:

[0114] To verify the feasibility of this invention in the field of river flood control and early warning, it was deployed in a smart water conservancy management platform for a major river basin in a certain province. This platform covers a key flood control section of the middle and lower reaches of the Qingjiang River, spanning 180 kilometers, with a total of 45 monitoring stations along the route, including hydrological stations, rainfall stations, and meteorological stations, and three key water conservancy dams. The basin has complex terrain, concentrated rainfall during the flood season, and rapid flood evolution, posing significant challenges to traditional forecasting methods. Traditional hydrological forecasting systems mainly rely on simplified empirical formulas and one-dimensional steady flow models, which are insufficient for dynamic responses to sudden heavy rainfall and dam scheduling, resulting in limited forecast accuracy. Especially in forecasts with a lead time exceeding 6 hours, water level errors often exceed 50 centimeters, making it difficult to meet the needs of refined flood control scheduling.

[0115] In practical deployment, the method of this invention first performs spatiotemporal alignment and preprocessing on the aforementioned multi-source hydrological data to construct a high-quality core driving data stream. Subsequently, the system constructs a hydrodynamic digital twin model based on the Saint-Venant equations and tightly integrates it with the data assimilation module. During flood evolution, the system uses the measured water level at the downstream section in real time to invert and dynamically correct the channel roughness parameters, ensuring that the digital twin remains synchronized with the real channel. Based on this, the system concatenates the state output of the real-time simulation twin with the core driving data stream and inputs it into the improved Seq2Seq-Attention model. The core innovation of this model lies in its bias-driven state switching mechanism: when the physical model calibration accuracy is high, the standard prediction mode is adopted to pursue the highest accuracy; when the physical model calibration bias increases due to extreme events, it automatically switches to a conservative prediction mode, enhancing the model's robustness by attenuating the weight of historical information and avoiding error propagation. Table 1 below shows the comparison data of the prediction performance of the method of this invention and existing traditional forecasting models in a typical flood process:

[0116] Table 1. Performance Comparison Data Between the Invention and Traditional Methods

[0117] Method type Forecast period Absolute error of average water level Peak water level error Peak time error Forecast pass rate Average flood volume error Traditional methods 3 hours 0.42 0.68 +1.5 hours 75.2% 8.5% Method of the present invention 3 hours 0.15 0.22 +0.5 hours 96.8% 2.8% Traditional methods 6 hours 0.78 1.25 +3.2 hours 58.4% 15.3% Method of the present invention 6 hours 0.28 0.45 +1.0 hour 91.5% 5.1% Traditional methods 12 hours 1.55 2.10 - 32.1% 28.7% Method of the present invention 12 hours 0.51 0.85 +2.5 hours 82.3% 9.4%

[0118] As shown in the comparative data in Table 1, the method of this invention exhibits an overwhelming advantage in forecasting performance. Its core value lies in the revolutionary breakthroughs in three dimensions: accuracy, lead time, and robustness. In terms of forecast accuracy, this invention sharply reduces the average absolute error of water level over the 12-hour lead time from 1.55 meters in the traditional method to 0.51 meters, a reduction of 67.1%. More critically, the peak water level error is also reduced from 2.10 meters to 0.85 meters, an accuracy improvement of nearly 150%, which directly determines the success or failure of flood control decisions.

[0119] Regarding the effectiveness of the forecast period, traditional methods show a sharp drop in the pass rate to 58.4% after 6 hours, while this invention maintains a high pass rate of 82.3% even with a 12-hour forecast period, successfully elevating flood forecasting from short-term emergency response to medium-term decision-making, thus gaining valuable time for scheduling and deployment. In terms of system robustness, traditional methods are unable to effectively predict peak times with a 12-hour forecast period, exposing the fatal flaw of model instability. However, this invention, with its bias-driven state switching mechanism, can still provide reliable predictions up to +2.5 hours, demonstrating strong adaptability and stability under extreme conditions.

[0120] In summary, this invention, through the deep integration of physical and data models, achieves high-precision, long-term, and robust predictions of flood evolution, marking a fundamental shift in flood forecasting technology from experience-driven to science-driven approaches.

[0121] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A real-time simulation and prediction system for river flow based on digital twins, characterized in that, Includes the following modules: The multi-source data synchronous acquisition module is used to synchronously acquire multi-source data from the river channel and construct the core hydrological data stream; The data preprocessing module is used to preprocess the core hydrological data stream and output the core driving data stream; The hydrodynamic digital twin construction module is used to build a hydrodynamic digital twin model driven by water level difference based on the Saint-Venant equations, calculate the changes in water flow in the river channel, and output the water level difference driven twin model. The real-time simulation and assimilation calibration module is used to input the core driving data stream as boundary conditions into the water level difference driven twin model for real-time calculation, invert and update the corrected channel roughness parameters in real time, and output the real-time simulation twin. The intelligent rolling prediction module is used to predict the water level and flow sequence of downstream sections within a future time window based on real-time simulation twins and core driving data flow, and to generate multi-section prediction sequences. The visualization and early warning output module is used to present the multi-section prediction sequence on the digital twin platform and automatically trigger the early warning mechanism when the predicted water level or flow exceeds the preset safety threshold.

2. The real-time simulation and prediction system for river flow based on digital twins according to claim 1, characterized in that, The modules are connected in the following way: S1. Simultaneously collect multi-source data from the river channel to construct a core hydrological data stream; S2. Preprocess the core hydrological data stream and output the core driving data stream; S3. Based on the Saint-Venant equations, establish a hydrodynamic digital twin model driven by water level difference, calculate the change in water flow in the river channel, and output the water level difference driven twin model. S4. Input the core driving data stream as boundary conditions into the water level difference driven twin model for real-time calculation, invert and update the corrected channel roughness parameters in real time, and output a real-time simulation twin that is synchronized with the real channel state. S5. Based on real-time simulation twins and core driving data flow, the improved Seq2Seq-Attention model is used to predict the water level and flow sequence of downstream sections in future time windows, generating multi-section prediction sequences. S6. Present the multi-section prediction sequence on the digital twin platform, and automatically trigger the early warning mechanism when the predicted water level or flow exceeds the preset safety threshold.

3. The real-time simulation and prediction system for river flow based on digital twins according to claim 2, characterized in that, S1 specifically includes: S11. Simultaneously trigger the flow sensors deployed at the upstream and downstream sections of the river channel, the rain gauges deployed in the basin, the evaporation sensors deployed at the meteorological station, and the water level sensors deployed at the upstream and downstream sections to collect multi-source data on upstream section flow, downstream section flow, rainfall, evaporation, upstream section real-time water level, and downstream section real-time water level, respectively. S12. For the collected multi-source data, timestamps are aligned based on Coordinated Universal Time (UTC), and geographic coordinates are registered using a unified geospatial coordinate system to construct the core hydrological data stream.

4. The real-time simulation and prediction system for river flow based on digital twins according to claim 2, characterized in that, S2 specifically includes: S21. Read the upstream and downstream cross-sectional flow corresponding to the same timestamp in the core hydrological data stream, calculate the difference to obtain the interval flow difference, and multiply the rainfall in the watershed corresponding to the timestamp by the preset unit conversion factor to convert it into the interval theoretical runoff increment. S22. Compare the interval flow difference with the interval theoretical runoff increment. When the absolute value of the interval flow difference exceeds the preset error threshold range of the interval theoretical runoff increment, determine that the upstream and downstream cross-sectional flow of the timestamp are abnormal data points and remove them from the core hydrological data stream. S23. Traverse the core hydrological data stream, identify continuous missing data segments caused by data removal operations, locate the previous valid data point of the start time point and the next valid data point of the end time point for each missing data segment, use a linear interpolation algorithm to calculate the interpolated data value corresponding to each interpolation time point, fill all the interpolated data values ​​into the missing data segment, and output the core driving data stream.

5. A real-time simulation and prediction system for river flow based on digital twins according to claim 2, characterized in that, S3 specifically includes: S31. Based on the Saint-Venant equations, establish the governing equations for describing one-dimensional unsteady flow, consisting of the continuity equation and the motion equations after specific simplification. S32. The calculation steps of the continuity equation include calculating the rate of change of the upstream and downstream cross-sectional areas with time, and simultaneously calculating the rate of change of the river flow along the direction of water flow. The two rates of change are added together and the result is set to zero, indicating that in any small section of the river, the sum of the change in the upstream and downstream cross-sectional areas per unit time and the change in the flow per unit length of the river section is zero, which follows the law of conservation of mass. S33. The calculation steps of the simplified motion equation include calculating the product of the upstream and downstream cross-sectional areas, the gravitational acceleration, and the rate of change of water level along the flow direction; calculating the product of the upstream and downstream cross-sectional areas, the gravitational acceleration, and the frictional drop; adding the two products together and setting the result to zero, indicating that the driving force of the river flow evolution comes from the rate of change of water level along the flow direction, that is, the real-time water level difference between the upstream and downstream cross-sections, and the driving force and the riverbed frictional resistance reach instantaneous equilibrium. S34. The continuity equation is combined with the motion equation after a specific simplification. The real-time water level difference between the upstream and downstream sections is taken as the dominant driving force for the evolution of the water flow. The friction ratio is expressed parametrically using the Manning formula. A water level difference driven twin model is constructed with water level difference as input, downstream flow change as output, and channel roughness parameter as the key parameter to be calibrated.

6. The real-time simulation and prediction system for river flow based on digital twins according to claim 5, characterized in that, The Manning formula specifically includes: calculating the product of the square of the river roughness parameter and the square of the river flow rate; calculating the product of the square of the cross-sectional area of ​​the water passage and the cube of the radius of the water surface; and dividing the first product by the second product to obtain the value of the friction ratio.

7. A real-time simulation and prediction system for river flow based on digital twins according to claim 2, characterized in that, S4 specifically includes: S41. Read the upstream cross-section flow, rainfall in the basin and evaporation at the meteorological station at the current time step from the core driving data stream, and use them as boundary conditions to input into the water level difference driven twin model to perform real-time calculation of water flow evolution. The calculation process only considers the upstream inflow drive and ignores the direct impact of rainfall and evaporation on the river water volume. After the calculation is completed, the initial predicted water level of the downstream cross-section is output. S42. Independently calculate the net change in river water volume caused by rainfall and evaporation, read the rainfall in the basin at the current time step, multiply the rainfall by the preset unit conversion factor, and obtain the increase in runoff into the river per unit time. S43. Read the evaporation amount at the current time step, multiply the evaporation amount by the current river surface area, multiply by the preset unit conversion factor to obtain the runoff reduction from the river evaporation per unit time, subtract the runoff reduction from the runoff increase to obtain the net change in river water volume at the current time step. S44. Based on the change in net river water volume, the initial predicted water level of the downstream section is compensated and corrected. The change in net river water volume at the current time step is multiplied by the calculation time step to obtain the total volume change within the time step. This volume is then divided by the upstream and downstream cross-sectional areas of the downstream section to obtain the water level compensation value. The water level compensation value is added to the initial predicted water level of the downstream section to generate the theoretical water level of the downstream section. S45. Read the measured water level of the downstream section that precisely corresponds to the current calculation time step from the core drive data stream, use it as a feedback calibration signal, subtract the theoretical water level from the measured water level of the downstream section, and calculate the water level deviation value of the current time step. S46. Based on the water level deviation value, the corrected river roughness parameter is inverted and output in real time. The preset sensitivity analysis matrix for data assimilation is retrieved. The sensitivity analysis matrix stores the partial derivative relationship between water level change and river roughness parameter change. S47. Input the water level deviation value at the current time step into the sensitivity analysis matrix. Calculate the correction amount of the channel roughness parameter required to bring the water level deviation value close to zero through matrix multiplication. Read the channel roughness parameter value currently in use in the water level difference driven twin model and algebraically add it to the correction amount to obtain the corrected channel roughness parameter. S48. Write the corrected channel roughness parameters to the parameter storage area of ​​the water level difference driven twin model in real time through the data interface and update it. Based on the updated water level difference driven twin model state and parameters, output the real-time simulation twin.

8. A real-time simulation and prediction system for river flow based on digital twins according to claim 2, characterized in that, S5 specifically includes: S51. Taking the real-time simulation twin as the starting point, set the time window length, and extract the upstream cross-section flow, rainfall, evaporation, upstream cross-section real-time water level and downstream cross-section real-time water level of each hour in chronological order from the core driving data stream to form multivariate time series data. S52. The current downstream section water level and flow rate in the real-time simulation twin are used as the current state data. The multivariate time series data and the current state data are concatenated according to the feature dimension to obtain the input matrix of the improved Seq2Seq-Attention model. S53. Input the input matrix into the encoder of the improved Seq2Seq-Attention model in the order of time steps. Perform linear transformation and non-linear activation through the preset activation function and weight matrix to calculate the hidden state of the current time step. Output the hidden states of all time steps to form the encoder hidden state sequence. S54. A deviation-driven state switching layer is added. A state switching threshold is set. The absolute value of the water level deviation value at the current time step is read and compared with the state switching threshold. When the absolute value of the deviation value is less than or equal to the state switching threshold, it is determined that the current calibration accuracy is high. The standard prediction mode is selected and the encoder hidden state sequence is directly used as the input of the decoder. S55. When the absolute value of the deviation is greater than the state switching threshold, it is determined that the current calibration accuracy is low, and the conservative prediction mode is started. A preset attenuation coefficient less than 1 is applied to each vector in the encoder hidden state sequence to perform element-wise numerical scaling. The scaled encoder hidden state sequence is used as the input of the decoder. S56. Perform a dot product operation between the hidden state of the decoder at the previous time step and each vector in the hidden state sequence of the encoder to obtain the original alignment score. Normalize all the original alignment scores through the Softmax function to obtain the attention weight vector. S57. The attention weight vector and the encoder hidden state sequence are weighted and summed to generate the context vector of the current time step. This context vector is then concatenated with the input of the decoder at the current time step and fed into the recurrent neural network of the decoder. Linear transformation and nonlinear activation are performed through the preset activation function and weight matrix to calculate the predicted water level and flow rate at the current time step and update the hidden state of the decoder. S58. Arrange the predicted water level and flow data of each time step output by the decoder in chronological order according to the timestamp to construct a multi-section prediction sequence.

9. A real-time simulation and prediction system for river flow based on digital twins according to claim 2, characterized in that, S6 specifically includes: visually rendering the multi-section prediction sequence on a digital twin platform, presenting it in the form of dynamic evolution curves and three-dimensional water flow patterns, and automatically triggering an early warning mechanism when the predicted water level or flow exceeds a preset safety threshold, outputting and pushing early warning information.

Citation Information

Cited By

  • River fall measurement method and system based on dynamic calibration

    CN122281844B