Step channel water level prediction method

By generating minute-level aligned datasets and using a conditional bi-branch local model and hydraulic composite distance verification, the problem of inaccurate water level prediction caused by gate peak shaving in cascade waterways was solved, achieving high-precision and physically reasonable water level prediction under strong dynamic conditions.

CN121052174BActive Publication Date: 2026-02-03NANJING HYDRAULIC RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511598410.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-04
Publication Date
2026-02-03
Estimated Expiration
2045-11-04

AI Technical Summary

Technical Problem

Existing technologies struggle to address the timeliness and accuracy of water level predictions in cascade waterways caused by strong unsteady flows resulting from daily peak shaving at gates. This is especially true when data is scarce, as local dynamic distortions and physical inconsistencies in spatial profiles are difficult to resolve.

Method used

By generating a minute-level aligned dataset, a conditional bi-branch local model is used for hysteresis modeling. Combined with hydraulic composite distance and physical consistency checks, the cross-sectional hydraulic relationship is reconstructed. Local short-window prediction and spatially consistent candidate prediction are integrated to generate the final water level prediction.

Benefits of technology

It improves the accuracy and reliability of water level prediction for cascade waterways, ensuring the accuracy of instantaneous water level changes and the physical rationality of spatial profiles under highly dynamic conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121052174B_ABST
    Figure CN121052174B_ABST
Patent Text Reader

Abstract

The application discloses a kind of cascade channel water level prediction methods, comprising: obtaining original monitoring data and observation element information, generate minute level alignment data set;Based on the data set, through by path dependence characteristic driven conditional double-branch local model, hysteresis modeling is carried out, and local short window prediction is generated;Joint the data set and local short window prediction, through reconstructing cross-section hydraulic relationship to generate spatially consistent candidate prediction;Through by real-time hydraulic working condition dynamic adjustment, and built-in physical constraint working condition conditional meta-learner, local short window prediction and spatially consistent prediction are fused, and final water level prediction is generated.The application accurately describes short-time hysteresis effect by introducing double-branch structure, and guarantees the physical rationality of spatial profile through hydraulic composite distance, physical consistency test, cross-section loss function mechanism, improves the water level prediction accuracy and reliability under strong dynamic working condition such as gate peak shaving.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to water level prediction technology, and in particular to a method for predicting water levels in cascade waterways. Background Technology

[0002] Cascade waterways are key projects for improving navigation conditions on mountainous rivers. Accurate prediction of waterway levels is a prerequisite for the joint scheduling of cascade hubs, the planning and design of navigation facilities, and ensuring the safety of ship navigation. Especially against the backdrop of increasing demand for peak-shaving power, the frequent opening and closing of hydropower station gates throughout the day leads to highly unsteady water flow characteristics in the waterways, placing even higher demands on the timeliness and accuracy of water level prediction.

[0003] Currently, the technical approaches for predicting water levels in cascade waterways mainly fall into two categories. One is the hydrodynamic model method based on physical processes, which simulates water flow evolution by solving the Saint-Venant equations, possessing a solid theoretical foundation. The other is the data-driven method. With the development of monitoring technology, this method utilizes machine learning or deep learning models, such as support vector regression, decision tree models, and recurrent neural networks, to directly learn the mapping relationship between inputs (such as upstream and downstream boundary conditions) and outputs (target section water levels) from massive amounts of historical monitoring data. When data is abundant, data-driven methods demonstrate better predictive performance in specific scenarios and are gradually becoming a research hotspot in this field.

[0004] However, existing technologies face a dual challenge in dealing with complex hydraulic phenomena caused by strong unsteady flows such as intraday peak shaving by gates: local dynamic distortion and physical inconsistencies in spatial profiles. Specifically, rapid gate opening and closing can induce hysteresis effects between water level and flow rate within a short timeframe (e.g., minutes), meaning the water level-flow rate curves do not coincide during the rising and falling water phases. Traditional single-valued function models, whether empirical formulas in physical models or standard regression models in data-driven approaches, struggle to accurately characterize this path-dependent characteristic, leading to significant phase and amplitude biases when predicting instantaneous water level changes. Furthermore, due to the lack of cross-sectional physical constraints, when prediction models for each section run independently, these local prediction biases accumulate and propagate, easily resulting in water level profiles along the route exhibiting phenomena that violate basic hydraulic laws, such as negative slopes where downstream water levels are higher than upstream or reversed energy lines. Existing integrated fusion methods mostly rely on weighted averaging at the numerical level, failing to fundamentally guarantee the physical consistency of prediction results in the spatial dimension. Summary of the Invention

[0005] The purpose of this invention is to address the aforementioned problems in the existing technology by providing a method for predicting the water level of a cascade waterway.

[0006] Technical solution: A method for predicting water levels in cascade waterways, comprising:

[0007] Acquire raw monitoring data and observation metadata to generate minute-level aligned datasets;

[0008] Based on minute-level aligned datasets, hysteresis modeling is performed using a pre-configured conditionalized bi-branch local model to generate local short-window predictions.

[0009] By combining minute-level aligned datasets with local short-window predictions, spatially consistent candidate predictions are generated by reconstructing cross-sectional hydraulic relationships.

[0010] By integrating local short-window forecasts with spatially consistent candidate forecasts, a final water level forecast is generated.

[0011] Beneficial effects: This invention accurately characterizes the short-time hysteresis effect by introducing a dual-branch structure, and ensures the physical rationality of the spatial profile through mechanisms such as hydraulic composite distance, physical consistency verification, and cross-section loss function, thereby improving the accuracy and reliability of water level prediction under strong dynamic conditions such as gate peak regulation. Attached Figure Description

[0012] Figure 1 A flowchart illustrating the steps of a method for predicting the water level of a cascade waterway, as provided in this application embodiment.

[0013] Figure 2 A flowchart illustrating the steps for generating spatially consistent candidate predictions provided in this application embodiment.

[0014] Figure 3 A flowchart illustrating the steps for generating local short-window predictions provided in this application embodiment.

[0015] Figure 4 A flowchart illustrating the steps for jointly generating local short-window predictions provided in this application embodiment. Detailed Implementation

[0016] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0017] It should be noted that the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or device.

[0018] To better understand the technical background and the technical problem to be solved in this application, a benchmark method for predicting the water level of cascade waterways is first introduced for comparison. This method generates data based on a hydrodynamic model and combines it with a traditional ensemble learning framework for prediction. Specifically, the benchmark method includes the following steps:

[0019] The boundary flow, boundary water level, number of river segments, and simulation time of the cascade waterways within the basin are divided and preset.

[0020] In this step, the study channel range is determined, the flow rate Q and water level Z at the upstream boundary are obtained, and their variation ranges Qi and Zi are set. At the same time, based on the physical characteristics of the channel, the number of river segments B and the number of cross sections S[B] of each river segment are set, and the total simulation time T and the initial values ​​of water level and flow rate of each cross section are initialized.

[0021] A hydrodynamic model is constructed to collect and process data, generating a dataset.

[0022] Specifically, this hydrodynamic model is constructed based on the Saint-Venant equations, which consist of a water balance equation and a motion equation: ΨQ / Ψx + B(ΨZ / Ψt) = q L ;ΨZ / Ψx +(α / gA) (ΨQ / Ψt)+(1 / 2g) (Ψ / Ψx)(Q 2 / A 2 )=S f Where Q is the cross-sectional flow rate; Z is the average water level of the cross-section; B is the width of the river surface; q L y is the lateral inflow rate; x is the longitudinal channel distance; t is time; A is the cross-sectional area of ​​the water passage; g is the acceleration due to gravity; S f Let Ψ be the energy slope, α be the partial derivative, and α be the momentum correction coefficient. Using this model, simulations are performed under preset boundary conditions and various hub operating conditions, generating a dataset containing multiple samples. Each sample contains multiple input features and a continuous water level value as the output variable.

[0023] Build a dataset optimizer to perform feature engineering and hyperparameter optimization on the generated data.

[0024] For example, Lasso regression (a variant of ridge regression) can be used to evaluate and filter the importance of features, with the objective function being: min w (1 / 2N)∑ i=1 N (y i -∑ j=1 M w j x ij ) 2 +λ∑ j=1M |w j |; where N is the number of samples; M is the number of features; y i x is the true target value for the i-th sample; ij w is the j-th feature value of the i-th sample; j λ is the weight coefficient of the j-th feature; λ is the regularization parameter.

[0025] Based on the optimized dataset, various data-driven base models are selected to predict channel water levels. Optional base models may include K-Nearest Neighbors (KNN), decision tree models, and deep learning models.

[0026] Constructing an ensemble learning model integrates the predictions of multiple excellent models to improve the model's generalization performance. For example, a stacking method can be used to train a meta-learner by using the predictions of multiple base models as new features for the final prediction.

[0027] It can be seen that this benchmark method has significant limitations when dealing with small and medium-sized rivers in western regions where monitoring data is scarce. The quality and quantity of the generated dataset heavily depend on the accuracy of the hydrodynamic model and the completeness of the preset operating conditions. At the same time, conventional ensemble learning methods only fuse data at the data level, which cannot guarantee that the prediction results between different cross sections conform to the laws of hydraulics. This can easily lead to physically unreasonable prediction profiles, resulting in low prediction accuracy and reliability.

[0028] like Figure 1 As shown, a method for predicting the water level of a cascade waterway is proposed, including:

[0029] Obtain raw monitoring data and observation metadata to generate minute-level aligned datasets.

[0030] Alternatively, it can be described as acquiring raw monitoring data and observation metadata, preprocessing, and generating minute-level aligned datasets; the preprocessing includes at least the unified calibration of the time axis, the identification and removal of outliers, and the interpolation of short-term missing data.

[0031] In this embodiment, for example, the raw monitoring data may include the cross-sectional geometric information B, the roughness empirical value N, and the upstream boundary flow sequence Q. up The water level sequence Z at the downstream boundary down , gate opening sequence G, and historical water level sequence Z histThe observation metadata includes sampling intervals, time zones, and missing data markers. These raw data undergo time-axis calibration, outlier identification and removal, short-term missing data interpolation (e.g., using spline interpolation or Kalman filtering), and multi-source data synchronization processing to form a time-aligned, high-quality minute-level dataset, denoted as D. align This ensures the time synchronization and accuracy of the input data.

[0032] Based on minute-level aligned datasets, hysteresis modeling is performed using a pre-configured conditionalized bi-branch local model to generate local short-window predictions.

[0033] In this embodiment, the hysteresis effect in the short-term (e.g., 5-20 minutes) water level evolution process caused by rapid changes in operating conditions such as gate step jumps is accurately characterized. The hysteresis effect refers to the physical phenomenon that even with the same flow rate, the corresponding water level may differ during rises and falls. Therefore, a special conditionalized bifurcation local model H is established for each monitoring section. local The model internally includes parallel branches dedicated to depicting the rising water level and the falling water level. This is achieved through analysis of a minute-level aligned dataset D. align Through training, the model can learn the water level evolution characteristics under different flow conditions and generate local short-window predictions Z that are highly consistent with local dynamic changes in the time dimension. loc .

[0034] By combining minute-level aligned datasets with local short-window predictions, spatially consistent candidate predictions are generated by reconstructing cross-sectional hydraulic relationships.

[0035] Specifically, local short-window prediction Z loc While achieving high accuracy on the time series of individual cross-sections, the models for each cross-section are trained independently. Combining their predictions at the same time may lead to phenomena that do not conform to physical laws, such as downstream water levels being higher than upstream levels. Optionally, the physical relationship between cross-sections can be reconstructed by introducing prior hydraulic knowledge. For example, a hydraulic composite distance can be constructed to measure the physical similarity between cross-sections, and combined with physical consistency check rules, or a cross-section consistency loss function can be constructed to penalize unreasonable spatial water level profiles. This can correct the initial prediction or generate new predictions, ultimately obtaining a spatially consistent candidate prediction Z that is physically reasonable in the spatial dimension. spa .

[0036] By integrating local short-window forecasts with spatially consistent candidate forecasts, a final water level forecast is generated.

[0037] In this embodiment, prediction results with two different advantages are intelligently fused. Local short-window prediction Z locIts advantage lies in its high dynamic response and accuracy in time, while the spatially consistent candidate prediction Z... spa The advantage lies in its spatial physical rationality. Optionally, by constructing a condition-based meta-learner H... meta This learner can identify the current real-time hydraulic conditions (such as the magnitude of upstream flow and the degree of downstream backwater), and adaptively determine the appropriate action for Z based on these conditions. loc and Z spa The degree of trust (i.e., fusion weight) is considered. Furthermore, a physical consistency regularization term can be introduced as a constraint during the fusion process to ensure that the final fusion result Z... hat It is not only numerically optimal, but also physically reliable.

[0038] In summary, this embodiment achieves a deep synergy between data-driven approaches and physical laws through a complete technical chain, from time alignment to local hysteresis modeling, then to spatial consistency reconstruction, and finally to conditional fusion, thereby providing more accurate and reliable cascade waterway level predictions.

[0039] In one possible implementation, such as Figure 3 As shown, generating local short-window predictions includes:

[0040] For each cross section, a conditional bi-branch local model is established, in which a rising water branch and a falling water branch are set in parallel.

[0041] In other words, for each cross section, a dual-branch local model with rising water branches and falling water branches is established in parallel.

[0042] In this embodiment, the dual-branch local model decomposes the complex hysteresis process into two relatively simple sub-processes: rise and fall, and establishes dedicated prediction modules for each. A preferred implementation is that the model includes a shared backbone network Φ(•θ). shared ) and two independent branch head networks f up (•;θ up ), f down (•;θ down Specifically, the extracted path-dependent features are used as input X. branch Through the shared backbone network Φ(•;θ) shared Extract common, high-dimensional feature representation h, i.e., h = Φ(X) branch ;θ shared This shared backbone can be a multi-layer feedforward network or a temporal convolutional network, and its function is to learn the common associations between different path-dependent features. This common feature representation h is then input into the two branch head networks to obtain the predicted output z of the flood branch. up The predicted output z of the water branchdown That is: z up =f up (h;θ up );z down =f down (h;θ down ); where h is the intermediate feature representation of the shared backbone network output; θ shared θ up θ down These are the model parameters for the shared backbone, the rising water branch, and the falling water branch, respectively; z up The predicted future water level for the rising water branch; z down This represents the predicted future water level for the branch that is sinking.

[0043] The dual-branch local model is trained using a minute-level aligned dataset. The rising water branch is used to specifically characterize the water level evolution characteristics during the rising water process, while the falling water branch is used to specifically characterize the water level evolution characteristics during the falling water process. Together, they generate local short-window predictions.

[0044] Furthermore, such as Figure 4 As shown, the joint generation of local short-window predictions includes:

[0045] Path-dependent features that characterize the process and direction of hydraulic state changes are extracted from minute-level aligned datasets; path-dependent features include water level change rate, flow rate change rate, or cumulative fluctuation index.

[0046] In this embodiment, these features are key to driving the subsequent decision-making of the two-branch model. Specifically, they can be derived from the minute-level aligned dataset D. align In this study, data within a time window (e.g., 5-20 minutes) is extracted before and after an event in which the gate opening G changes significantly (i.e., a gate step). Within this window, a series of features reflecting the dynamic evolution path of the water flow are calculated; these features are collectively referred to as path-dependent features. For example, these path-dependent features include: first-order and second-order derivative features: such as the rate of change of water level with respect to time dZ / dt, the rate of change of flow rate with respect to time dQ / dt, and the second-order rate of change of water level d... 2 Z / dt 2 The sign (positive or negative) of dZ / dt directly indicates whether the water level is currently rising or falling. Cumulative rise / fall index: the cumulative increase or decrease in water level within an event window. Optionally, path-dependent features also include residual features to characterize hysteresis memory effects; these residual features are determined by quantifying the recovery time or water level regression rate between the current hydraulic event and the previous hydraulic event. In other words, residual features characterize the degree of influence of the previous event on the current event, i.e., the system's memory effect. For example, the recovery time t from the end of the previous event to the start of the current event can be calculated. recAnd a water level regression rate ρ, which characterizes how quickly the water level recovers to the baseline level. rec .

[0047] The gating mechanism built into the conditionalized bi-branch local model is driven by path-dependent features. The contribution weights of the rising water branch and the falling water branch are dynamically determined by the gating mechanism. Based on the contribution weights, the outputs of the rising water branch and the falling water branch are dynamically weighted and fused to obtain local short-window predictions.

[0048] In this embodiment, the gating mechanism is the core of realizing intelligent collaboration between the two branches. Specifically, a gating function g(•) can be designed, which also takes the common feature h as input and outputs a scalar g between 0 and 1. This scalar serves as the contribution weight w of the flood branch. up , while (1-g) is used as the contribution weight w of the falling water branch. down A typical gating function is the sigmoid function: g = σ(ω T h+b); w up =g;w down =1-g; where g is the output value of the gating function; σ(•) is the Sigmoid activation function; ω and b are the weights and bias parameters of the gating function, which are obtained through training along with other parameters of the model; T Indicates transpose; w up The contribution weight of the rising water branch; w down The contribution weights of the two branches are assigned to the water-falling branch. The prediction outputs of the two branches are weighted and summed according to the dynamic weights calculated by the gating mechanism to obtain the original local short-window prediction z. loc_raw :z loc_raw =w up ·z up +w down ·z down Among them, z loc_raw This represents the original local short-window predictions after fusion. The model can automatically determine whether the current state is more inclined towards rising or falling water based on the path-dependent features of the input (such as the sign of dZ / dt) and assign higher weights to the corresponding branches.

[0049] Optionally, during model training, a branch switching suppression term is further included in the training objective function of the conditional bi-branch local model; the branch switching suppression term penalizes changes in contribution weights over time.

[0050] In this embodiment, to make the changes in gating weights smoother over time and avoid overly frequent and drastic weight switching near the fluctuation threshold, the overall training loss function L can be adjusted. local Add a branch switching suppression term L to the middle switchThis is designed to penalize changes in contribution weights over time. For example, a complete loss function can be defined as: L local =L data +α·L branch +β·L switch Among them, L local L is the total loss function of the local model; data For data fitting loss terms, such as the mean squared error (MSE) between predicted and true values; L branch For branch supervision loss terms, for example, using a soft label y generated based on the dZ / dt notation. branch The learning of gating weights is guided by binary cross-entropy (BCE) loss; L switch For branch switching suppression terms, such as the gating weights w at adjacent time points. up The change is taken as the L1 norm, i.e., L switch =∣w up (t)-w up (t-1)∣; α and β are the hyperparameter weights of each loss term. By minimizing this total loss function to train the entire model, the model can be made more stable and robust in its internal decision-making process while ensuring prediction accuracy.

[0051] This embodiment constructs a conditional bi-branch local model and utilizes path-dependent features to drive a built-in gating mechanism for dynamic fusion. It also introduces a branch switching suppression term into the training objective, enabling accurate capture and reproduction of minute-level water level-flow hysteresis effects caused by events such as rapid gate opening and closing. Because this embodiment does not use a traditional single-valued function model to fit complex hysteresis loops, but instead decouples the physical processes—by establishing two dedicated branches for rise and fall—modeling the upper and lower branches of the hysteresis loop respectively, the learning difficulty of the model is reduced. More importantly, by extracting path-dependent features from the data that characterize water flow memory and direction to drive gating, the model can autonomously determine which physical process branch it is currently in based on real-time hydraulic conditions and dynamically allocate weights. This solves the problem of local dynamic distortion caused by the model's inability to distinguish between rise and fall processes, improving the model's prediction accuracy for instantaneous water level changes (especially in peak time and peak size) under strongly non-constant operating conditions, and providing a high-fidelity foundation for subsequent spatial consistency modeling.

[0052] like Figure 2 As shown, according to one aspect of this application, generating spatially consistent candidate predictions includes:

[0053] Based on the cross-sectional attributes contained in the minute-level aligned dataset, a hydraulic composite distance is constructed to measure the physical similarity between any two cross-sections.

[0054] In this embodiment, whether the hydraulic behaviors of two cross-sections in a river channel are similar depends not only on their geographical distance but also on physical properties such as the hydraulic gradient and riverbed roughness between them. Therefore, a hydraulic composite distance D can be defined. hyd This is used to replace the traditional Euclidean distance. Specifically, constructing the hydraulic composite distance involves jointly representing the friction distance, hydraulic gradient difference, and roughness difference obtained from minute-level aligned datasets to generate the hydraulic composite distance. A preferred calculation method is as follows: D hyd (i, j, t) = w s * (s(i,j) / s0) + w I * (|I h (i, t) - I h (j,t)| / I0) +w n * (|N(i) - N(j)| / n0); where D hyd (i, j, t) represents the hydraulic composite distance between cross-sections i and j at time t. A smaller value indicates more similar hydraulic behavior between the two cross-sections at that time; i and j are indices of different cross-sections; t is the time index; w s w I and w n These are preset non-negative weighting coefficients used to adjust the relative importance of the three components. For example, they can be set to 0.5, 0.3, and 0.2 respectively, and their sum is usually normalized to 1; s(i,j) is the friction distance from section i to section j; I h (i, t) represents the hydraulic gradient of section i at time t, which can be approximated by the water level difference between adjacent sections; N(i) is the roughness coefficient of section i (e.g., Manning coefficient); s0, I0, and n0 are the normalization coefficients of their respective physical quantities, used to eliminate the influence of different physical dimensions. This combined hydraulic distance allows for more accurate identification of neighboring sections with similar hydraulic response patterns to the target section.

[0055] Based on the hydraulic composite distance, a physical neighborhood is determined for each cross section, thereby generating spatially consistent candidate predictions.

[0056] Specifically, the physical neighborhood refers to, for the target cross section i, among all other cross sections, the distance D described above based on the hydraulic composite distance. hyd Sort the data points (i, j, t) and select the k cross-sections with the smallest distances to form their physical neighborhood N at time t. topo(i) The cross-sections within this neighborhood are highly correlated with the target cross-section in terms of physical behavior, therefore their water level information has high reference value for predicting the water level of the target cross-section. When constructing a prediction model using the physical neighborhood, for example, spatially consistent candidate predictions are generated, including: establishing physical consistency verification rules based on preset hydraulic criteria; when constructing a prediction model for any cross-section using its physical neighborhood, the construction process of the prediction model is reviewed according to the physical consistency verification rules, and only model construction operations that meet the hydraulic criteria are accepted to obtain spatially consistent candidate predictions. Specifically, instead of making corrections after the prediction is completed, the model is reviewed using physical laws at every step of model learning or decision-making. This review mechanism is the physical consistency verification rule P. check .

[0057] As an example, this verification rule is applied in two commonly used prediction models: In one optional implementation, when the prediction model is a decision tree model: the model building operation is specifically a candidate splitting operation; the verification process involves checking whether both subsets generated by the candidate splitting operation satisfy preset hydraulic criteria. These hydraulic criteria include non-negative average gradient or non-reversed energy lines within the subsets, and the candidate splitting operation is only allowed if both subsets satisfy the hydraulic criteria. In other words, during the growth of the decision tree, whenever the algorithm attempts to determine a feature (such as upstream flow Q), the splitting operation is performed. up Is it greater than 500m? 3 When splitting the dataset, the algorithm examines the two child nodes resulting from the split. If the average water level profile formed by the samples in either child node exhibits a physically unreasonable phenomenon (such as the downstream water level being higher than the upstream water level), the split operation is rejected, and the algorithm must find another more reasonable splitting method. This prevents the model from learning decision rules that violate physical laws.

[0058] In another optional implementation, when the prediction model is a nearest neighbor model: the model construction operation specifically involves selecting effective neighboring sections from candidate sections; the review process specifically involves judging the physical rationality based on the hydraulic composite distance between the candidate section and the current target section, and only accepting the candidate section as an effective neighboring section if the hydraulic composite distance is less than a preset threshold representing the upper limit of physical similarity. That is, when using models such as K-Nearest Neighbors (KNN) for prediction, it is not simply a matter of selecting the k neighbors with the smallest hydraulic composite distance. Physical consistency check rule P check An additional constraint will be imposed, for example, requiring that the hydraulic composite distances of these k neighbors to the target section must all be less than a preset threshold d. maxIf enough neighbors that meet the criteria cannot be found, the model can choose to lower the k value or issue a low-confidence prediction. This ensures that the reference samples (neighbors) used for prediction are physically similar to the target cross-section.

[0059] This embodiment incorporates hydraulic knowledge into the underlying logic of model construction, enabling the generation of spatially consistent candidate predictions Z. spa Structurally, it is physically sound, which reduces the difficulty and scope of subsequent modifications.

[0060] According to another aspect of this application, generating spatially consistent candidate predictions further includes: constructing a cross-sectional consistency loss function to quantify the degree of conformity between the water level profile along the route and physical laws; applying the cross-sectional consistency loss function to the optimization process of local short-window prediction, and generating spatially consistent candidate predictions by penalizing water level profile morphologies that do not conform to physical laws.

[0061] Optionally, the cross-section consistency loss function is constructed as follows:

[0062] For any adjacent cross-section group, determine the discrete water level gradient G. z Discrete water level slope G z It equals the difference in water level between the two sections divided by the distance along the course.

[0063] For example, G z (i,t) = (Z(i,t) - Z(i+1,t)) / Δ s_i ; where G z (i, t) represents the discrete water level gradient between upstream section i and downstream section i+1 at time t; Z(i, t) and Z(i+1, t) represent the water levels at the two sections, respectively; Δ s_i G represents the friction distance between the two cross sections. Under normal flow conditions, G z It should be a non-negative value.

[0064] The energy line E of adjacent cross sections is approximately calculated. The energy line E is equal to the sum of the water level and velocity head of the corresponding cross section.

[0065] For example, E(i,t) = Z(i,t) + v(i,t) 2 / (2 * g grav ); where E(i,t) is the energy line height of section i at time t; v(i,t) is the average flow velocity of the section, which can be obtained by dividing the flow rate Q(i,t) by the cross-sectional area A(i); g grav Let E(i) be the gravitational acceleration constant. According to the law of conservation of energy, without considering head loss, the energy line should decrease monotonically along the direction of water flow, i.e., E(i) >= E(i+1).

[0066] Cross-section consistency loss function L xsec To accumulate the following expression over a predetermined number of time steps: λ g * max(0, -G) z ) + λ e * max(0, E(i) - E(i+1)) 2 Where E(i) and E(i+1) represent the energy lines of the upstream and downstream sections, respectively, and λ g and λ e These are the preset non-negative weighting coefficients.

[0067] For example, L xsec = ∑ t (∑ i (λ) g * max(0, -G) z (i, t)) + λ e * (max(0,E(i+1,t) - E(i,t))) 2 The formula here changes the energy line penalty term to penalize the case where the downstream is higher than the upstream, i.e., E(i+1)-E(i)>0, which is more in line with physical intuition. Where L xsec For the total cross-sectional consistency loss; ∑ t and ∑ i This indicates that the summation is performed over all time steps and all adjacent cross-section groups; max(0, •) indicates taking the positive part, i.e., taking 0 when the expression is negative; λ g and λ e This is a preset non-negative weighting coefficient used to balance the penalties for two violations: negative water level slope and reverse energy line. For example, λ g It can be set to 1.0, λ e It can be set to 0.1. The loss function L... xsec Just like physical police, any prediction result that shows the downstream water level is higher than the upstream level or the downstream energy is greater than the upstream level will produce a positive loss value, the magnitude of which is proportional to the degree of violation.

[0068] Optionally, the cross-sectional consistency loss function L xsec It can also be defined as the summation of the following expression over multiple time steps: λ g * max(0, -G) z ) + λ e * (E(i) - E(i+1)) positive 2 ;in(•) positive This indicates taking the positive part of the expression.

[0069] According to one aspect of this application, after obtaining preliminary spatial candidate predictions (e.g., directly combined from local models, denoted as Z), spa_raw After that, in order to satisfy the physical constraints, the optimization process is achieved through soft projection correction; the soft projection correction is performed by solving a minimization problem, the optimization objective of which is to minimize the amount of change to the initial spatial candidate prediction while ensuring that the corrected water level profile satisfies the soft constraints of non-negative water level slope and / or monotonic energy lines.

[0070] For example, this minimization problem can be formulated as: argmin Zspa (0.5*∑((Z spa - Z spa_raw ) 2 )+γ *L xsec (Z spa ) ); where Z spa It is the corrected, spatially consistent candidate prediction that needs to be solved; Z spa_raw This is the initial prediction of the input; the first term in the formula is the fidelity term, which requires the corrected result Z. spa Compared with the original result Z spa_raw As close as possible; the second term is the physical constraint term, namely the cross-sectional consistency loss L defined above. xsec It punishes Z spa The unreasonable form in; γ is a hyperparameter used to control the strength of physical constraints.

[0071] Furthermore, the minimization problem is solved by using the coordinate descent method or the projective gradient iteration method.

[0072] Specifically, since the objective function is convex and its physical constraints only involve adjacent cross-sections, an efficient iterative optimization algorithm can be used to solve it. For example, the coordinate descent method can adjust the water level prediction value of each cross-section individually or in groups to reduce the overall objective function, and converge to the optimal solution after multiple iterations. Using the method of this embodiment, any preliminary water level prediction profile that may have physical inconsistencies can be corrected into a smooth and reasonable spatially consistent candidate prediction Z that retains the original prediction information while strictly adhering to the basic laws of hydraulics. spa .

[0073] This embodiment introduces two optional, hydraulically based spatial consistency reconstruction mechanisms to ensure that the friction profile formed by multi-section water level predictions conforms to physical laws. Specifically, the first mechanism defines a hydraulic composite distance that integrates friction distance, gradient, and roughness, and establishes physical consistency verification rules. This places physical constraints beforehand in the construction of basic models such as KNN or decision trees, ensuring that the model does not generate knowledge that violates physical laws from the beginning of its learning process. The second mechanism constructs a differentiable cross-section consistency loss function L... xsec By combining soft projection correction with physical constraints as the optimization objective, post-processing corrections are performed on any preliminary predictions that may contain physical inconsistencies. This solves the problem of spatial profile physical inconsistencies, such as negative slope and reversed energy lines, caused by independent predictions of each section. It goes beyond simple smoothing or correction; it transforms abstract physical conservation laws into concrete, executable algorithmic steps, enabling the output of the data-driven model to shift from a set of isolated values ​​to a physically reliable, spatially continuous water level profile applicable to practical shipping scheduling and engineering analysis.

[0074] According to one aspect of this application, in a cascade waterway, it takes a certain amount of time for upstream hydrological events (such as changes in flow or water level) to propagate downstream; this time is called the propagation time delay. This time delay is not fixed but dynamically changes with real-time hydraulic conditions such as flow rate and river level, i.e., a variable propagation time delay. Ignoring this time delay and directly associating data from upstream and downstream at the same moment in a model is equivalent to matching a cause with a result that has not yet occurred, introducing physical misalignment and reducing model accuracy. Therefore, before generating spatially consistent candidate predictions, the method further includes: estimating the variable propagation time delay between adjacent sections online based on real-time hydraulic conditions centrally represented by minute-level aligned datasets; and using the variable propagation time delay to perform time alignment correction on the signal sequence of the upstream section to obtain a time-delay-corrected sequence for generating spatially consistent candidate predictions.

[0075] In this embodiment, for each pair of adjacent cross sections (i, i+1), at each time step t, it is necessary to estimate a propagation delay tau from the upstream cross section i to the downstream cross section i+1. var (i → i+1, t). One possible implementation method is to use sliding window cross-correlation analysis. Specifically, at time t, the water level or flow time series of upstream section i and downstream section i+1 over a past period (e.g., the past 60 minutes) are taken respectively, and the correlation coefficient of the two series under different time shifts is calculated. The time shift that makes the correlation coefficient reach its peak can be used as the propagation delay tau at the current time. varThe estimated value. Another preferred implementation method is to use an algorithm specifically designed for sequence alignment, such as Dynamic Time Warping (DTW). DTW can find the optimal nonlinear alignment path between two time series, which itself contains local time delay information that varies with time. In some more complex implementations, a lightweight neural network model (such as a causal dilated convolutional network) can also be trained, taking into account real-time hydraulic conditions (such as upstream flow Q). up (i, t), average river level, etc.), directly outputting the current propagation time delay tau var The prediction is based on the estimated variable propagation delay tau. var Then, this time delay is used to align the signal from the upstream section. For example, when constructing features to predict the water level at downstream section i+1 at time t, the signal Z(i,t) from upstream section i at time t should not be used directly, but rather the time-delay-corrected signal Z(i,t - tau) should be used. var In other words, generating a time-delay-corrected upstream signal sequence S. shift (i, t) = Z(i, t - tau) var (i → i+1, t)). If tau var It is not an integer and can be obtained by interpolating the Z(i) sequence. This time-delay correction sequence S shift It can then be used to calculate hydraulic composite distances, for example, by calculating hydraulic gradients using the corrected signal; it can also be used to calculate cross-sectional consistency losses, for example, on a corrected time base.

[0076] This embodiment, through the introduction of a variable propagation delay estimation and correction mechanism, ensures that the inter-section relationships learned by the spatial consistency model are based on correct physical causal chains, thereby improving the model's prediction accuracy and physical realism under highly dynamic conditions. Specifically, this embodiment recognizes that water wave propagation speed is affected by real-time flow conditions; therefore, it employs algorithms such as cross-correlation analysis or dynamic time warping to continuously and online estimate the time required for the signal to propagate from upstream to downstream. When constructing the spatial consistency model, the upstream signal corrected for this delay is used, rather than the original, time-misaligned signal. This ensures that the inter-section relationships learned by the model are based on correct physical causal chains, i.e., using real causes to predict corresponding results. This solves the signal mismatch problem caused by ignoring or using fixed delays, especially in scenarios with significant changes in propagation time such as flood rise and fall, effectively avoiding spurious correlations and making the foundation for spatial consistency reconstruction more solid, thus indirectly but significantly improving the overall accuracy of the final prediction.

[0077] In one embodiment of this application, generating a final water level prediction includes:

[0078] Extract condition embedding vectors from minute-level aligned datasets to represent real-time hydraulic conditions.

[0079] Optionally, the operating condition embedding vector is extracted, including: obtaining hydraulic control variables representing upstream boundary flow, downstream boundary water level and gate opening respectively from the minute-level aligned dataset; and integrating the hydraulic control variables to form the operating condition embedding vector.

[0080] In this embodiment, to enable the fusion model to possess situational awareness capabilities, a hydraulic condition embedding vector is introduced. The hydraulic condition embedding vector *r* is a numerical vector that summarizes the current hydraulic state of the entire river segment. Specifically, it can be derived from a minute-level aligned dataset D. align Extract the following variables to form vector r: upstream boundary flow Q up Downstream boundary water level Z down The gate opening G at the critical section. Optionally, it may also include the total lateral inflow Q. L The variables include the average width B, which characterizes the river channel geometry, and the average roughness N, which characterizes the riverbed resistance. By concatenating the values ​​of these variables at the current time t or their statistical values ​​(such as mean and variance) over a short time window in the past, an embedding vector r(t) is formed that can comprehensively characterize the real-time hydraulic conditions.

[0081] The pre-configured conditional meta-learner is driven by the condition embedding vector. By taking the condition embedding vector as input, the fusion weight of the meta-learner is dynamically adjusted to adaptively weight the local short window prediction and the spatially consistent candidate prediction to generate the final water level prediction.

[0082] Specifically, the condition-based learning device H meta This is the core of the fusion phase. Unlike traditional Stacking methods that use a fixed meta-model, the behavior of this learner is dynamically adjusted by the job embedding vector r. A preferred implementation is that the meta-learner H... meta (For example, a small neural network) not only receives Z loc and Z spa As input, it also receives r as conditional input. Its internal fusion weights w loc and w spa The parameters are no longer fixed, but dynamically generated by r, i.e.: (w loc w spa ) = f gate (r) Z hat = w loc * Z loc + w spa * Z spa ;where f gate(•) is a gated network with r as input and r as output weights; Z hat This is the final water level prediction. Under different operating conditions, Z... loc and Z spa The relative reliability of these parameters differs. For example, during a transient process of drastic gate changes (where r reflects this change), the model should place more trust in the Z-axis, which has a stronger dynamic response. loc Under stable backwater conditions (where r reflects the upstream and downstream water levels), the model should place greater trust in Z, which ensures a reasonable spatial profile. spa The meta-learner, through training, can automatically learn the mapping relationship between this operating condition and the optimal fusion strategy.

[0083] Optionally, in order to robustly train the fusion model and avoid information leakage, the training of the conditional meta-learner is achieved by generating a leak-free secondary training set; the generation of the leak-free secondary training set adopts a time-blocking cross-validation method, so that the timestamp of any data point used for validation is later than the timestamps of all data points used for training that data point.

[0084] Specifically, when processing time series data, conventional cross-validation can lead to data leakage issues by using future data to predict past data, thus overestimating model performance. To address this problem, this embodiment employs time-blocking cross-validation (or time-series cross-validation). Specifically, the entire training dataset is divided into K folds in chronological order. In the k-th iteration, the data from the first k-1 folds is used to train the base model (i.e., to generate Z-factory cross-validation). loc and Z spa The model is then used to predict the data at the k-th fold. This process is repeated, concatenating the predictions from all folds to form a leak-free secondary training set S. oof Each row in the training set contains the predicted value Z from the base model. loc Z spa And the corresponding working condition embedding vector r and the actual water level label Z true .

[0085] In addition, to further enhance the physical reliability of the final prediction results, a physical consistency regularization term may be optionally incorporated into the training objective of the condition-based meta-learner; the physical consistency regularization term is used to quantify the degree of deviation of the final water level prediction from the preset physical conservation laws, which include the conservation of mass and / or the conservation of momentum.

[0086] Specifically, the total loss function L of the meta-learner meta It can be defined as: L meta = L data (Zhat Z true ) +λ phys * L phys (Z hat ); where L data Is the final prediction Z hat Compared with the true value Z true Data fitting loss (e.g., MSE) between; L phys It is used to punish Z hat Regular terms that violate physical laws, for example, can be used to calculate the predicted result Z based on discretized mass or momentum conservation equations. hat The resulting equation residuals; λ phys This is the weight coefficient of the regularization term. Furthermore, the influence weight of the physical consistency regularization term on the training objective is determined by the dynamic weight coefficient; the value of the dynamic weight coefficient is adaptively adjusted according to the real-time hydraulic conditions represented by the working condition embedding vector. That is, the weight coefficient λ... phys It is not a fixed hyperparameter, but rather, like the fusion weights, it is dynamically generated from the condition embedding vector r, i.e., λ. phys = f λ (r). Where f λ (r) represents the weight λ from the working condition embedding vector r to the physical consistency regularization term. phys The mapping function. For example, in conditions where water flow changes drastically and physical laws are easily violated, the model can automatically increase λ. phys The value of strengthens the constraint on physical consistency.

[0087] In an optional embodiment, the conditional meta-learner further includes a physical consistency gating mechanism; the physical consistency gating mechanism is used to monitor in real time whether the local short window prediction and the spatially consistent candidate prediction violate preset physical constraints during adaptive weighting, and automatically reduce the weight of the corresponding candidate prediction when a violation is detected.

[0088] In this embodiment, the physical consistency gating mechanism can be viewed as a security audit module. Before the meta-learner performs weighted fusion, it quickly checks the input Z. loc and Z spa Does it contain obvious physical errors (such as a negative slope)? If it is found, for example, Z... loc If an unreasonable prediction occurs at some point, the gating mechanism will immediately force a reduction in the allocation to Z. loc weight w loc Even if the meta-learner itself tends to assign high weights to it, this is equivalent to a final veto, ensuring that candidate predictions with obvious physical flaws do not have an excessively negative impact on the final result. The final generated prediction result Z hatIt combines the advantages of multiple basic models and has the ability to adapt to working conditions and a solid guarantee of physical consistency.

[0089] This embodiment achieves intelligent and adaptive fusion of high-precision local prediction and high-reliability spatial prediction by constructing a condition-conditional meta-learner and introducing a dynamically weighted physical regularization term and a physical consistency gating. Specifically, the meta-learner uses condition embedding vectors extracted from upstream flow, downstream water level, and other data to perceive the global hydraulic situation and dynamically adjusts the trust level (fusion weight) of the two candidate predictions based on this. For example, under transient conditions with drastic gate changes, it automatically increases the weight of the local short-window prediction, which is good at capturing dynamics; while under stable backwater conditions, it places more trust in the spatially consistent prediction that ensures a reasonable profile. This solves the problem that traditional fusion methods use fixed weights and cannot adapt to changing conditions. In addition, physical conservation laws are added as regularization terms to the training objective, and their weights also change adaptively with the conditions, further ensuring that the final output approximates the physical truth solution as closely as possible under any conditions. This not only improves the model's generalization ability and robustness but also solves the defect of traditional fusion methods that only pursue numerical optimization while ignoring physical constraints, resulting in a high degree of unity between accuracy and physical reliability in the final prediction result.

[0090] In a specific embodiment, assume that water level prediction is being performed on a section of a cascade waterway, which includes two adjacent monitoring sections: upstream section 1 and downstream section 2. At a specific time t, the preliminary prediction model provides the predicted water level values ​​for these two sections, and it is necessary to calculate the cross-section consistency loss corresponding to this prediction. Input parameters include: section spacing (Δ... s_1 ): 500.0 m; predicted water level at section 1 (upstream) (Z(1,t)): 85.20 m; predicted water level at section 2 (downstream) (Z(2,t)): 85.25 m (this is a physically unreasonable prediction, the downstream water level is higher than the upstream); flow rate at section 1 (Q(1,t)): 100.0 m³ / s; flow area at section 1 (A(1)): 120.0 m²; flow rate at section 2 (Q(2,t)): 100.0 m³ / s (assuming no inflow); flow area at section 2 (A(2)): 120.0 m² (for simplified calculation, assuming the area is the same); gravitational acceleration (g grav 9.81 m / s 2 Negative slope penalty weight (λ) g ): 1.0; Energy line reverse penalty weight (λ) e ): 0.1. According to the definition, G z It equals the water level difference between the two sections divided by the distance along the course. G z (1,t) = (Z(1,t) - Z(2,t)) / Δs_1 = (85.20 - 85.25) / 500.0 = -0.05 / 500.0 = -0.0001; Since G z A negative value indicates a water level inversion (negative slope), thus triggering the first penalty term of the loss function. Calculate the flow velocity v = Q / A: v(1, t) = Q(1, t) / A(1) = 100.0 / 120.0 ≈ 0.833 m / s; v(2, t) = Q(2, t) / A(2) = 100.0 / 120.0 ≈ 0.833 m / s; calculate the energy line E = Z + v 2 / (2* g grav E(1,t) = 85.20 + (0.833) 2 ) / (2 * 9.81) = 85.20 + 0.694 / 19.62 ≈85.20 + 0.035 = 85.235 meters; E(2, t) = 85.25 + (0.83 ... 2 ) / (2 * 9.81) = 85.25 + 0.694 / 19.62 ≈ 85.25 + 0.035 = 85.285 meters; Since E(2,t) > E(1,t), it indicates that the energy at the downstream section is higher than that at the upstream section, and the energy line reverses, thus triggering the second penalty term of the loss function. Substituting the above calculation results into the loss function formula: L xsec_pair = λ g * max(0, -G z (1, t)) + λ e * (max(0, E(2,t) - E(1,t))) 2 = 1.0 * max(0, -(-0.0001)) + 0.1 * (max(0, 85.285 - 85.235)) 2 = 1.0 * max(0, 0.0001) + 0.1 * (max(0, 0.05)) 2 = 1.0 * 0.0001 + 0.1 * (0.05) 2= 0.0001 + 0.1 * 0.0025 = 0.0001 + 0.00025 = 0.00035. For this pair of adjacent cross sections, the cross-section consistency loss at time t is calculated to be 0.00035. This positive value quantitatively indicates that the current water level prediction profile violates fundamental hydraulic laws. In an optimization process that includes this loss term (such as soft projection correction or meta-learner training), this loss value serves as a gradient signal, driving the optimization algorithm to adjust the predicted values ​​of Z(1,t) and Z(2,t) (e.g., slightly increasing Z(1,t) and decreasing Z(2,t)) to make L xsec_pair The water level is reduced until it approaches zero, thereby restoring the physical consistency of the final water level profile.

[0091] In one possible embodiment of this application, the process of generating local short-window predictions may further include: reading a minute-level aligned dataset D. align The threshold step jump was located using a combined threshold and duration criterion. Short windows of 5–20 minutes were extracted around the event center to generate labeled short window data W. event Specifically, read D align Calculate the first-order difference ΔG(t) for the gate opening sequence G(t). Use the amplitude threshold g. amp With minimum duration g dur The joint criterion for locating event t0: condition: |ΔG(t0)|≥g amp And the continuous holding time is ≥ g dur The candidate event index E0 is obtained. The candidate event index E0 is read, and the merging time interval is less than gap. min Adjacent events are analyzed, isolated spikes are removed, and the cleaned-up event index E1 is obtained. The cleaned-up event index E1 and the minute-level aligned dataset D are then read. align For each event t0, an adaptive short window with a length of [5, 20] minutes is extracted (based on |ΔG| and the flow state selection window length) to construct the short window data W. event This includes the average water level Z of multiple cross-sections, the flow rate Q of the cross-section, the gate opening G, and the lateral inflow Q. L Based on short window data W event Calculate path-dependent features (sign and magnitude of dZ / dt and dQ / dt, cumulative fluctuation index, and residual from the previous event), and construct branch indicators and uncertainty priors to obtain branch features X. branch Specifically, read W event For each cross-section, calculate dZ / dt, dQ / dt, and d 2 Z / dt 2 And generate directional marker u z =sign(dZ / dt), u q= sign(dQ / dt). Combined into derivative characteristic F deriv Read W event Calculate the recovery time t from the previous event to the current event. rec Regression rate ρ with water level rec = (Z pre -Z base ) / (t now -t prev ), to obtain residual characteristic F res (Representing lag memory), where Z pre Z represents the water level at the end of the previous event. base t is the baseline water level for the current event. now t is the timestamp of the current event. prev This is the timestamp of the previous event. Combine the derivative features F. deriv Residual characteristics F res With respect to gate position step amplitude |ΔG|, duration, Q up Z down Wait, construct branch feature X branch Use threshold + soft label to generate flood / drowning branch indicators y branch ∈[0,1], obtain the branch soft label Y branch Using X branch With W event Training the local model H local Common representations are extracted using a shared backbone (sharing the first few layers if a feedforward network is used; sharing the preceding convolutions if temporal convolutions are used). Two gating heads then characterize the flood and slack water branches respectively. During the forward pass, soft gating is used to weight the two branches. The output is a local short-window prediction Z. loc_raw With branch weight W gate Specifically, read X branch W event Establish a shared backbone φ(·) to extract local short-window representation h =φ(X) branch φ can be a temporal convolutional or feedforward network (structure recorded to L). local ), to obtain intermediate characterization H mid In the intermediate characterization of H mid Construct two branch heads f above up f down Output Z up Z down ; and use g = sigmoid(ω) T H mid + b) Obtain the weight w up = g、w down = 1-g; Generate branch-weighted prediction Z loc_raw = w up ·Zup + w down ·Z down With branch weight W gate = (w up w down The training objective includes data loss and branch regularization: L data = mse(Z loc_raw Z true );L branch = bce(w up Y branch );L switch = η·|w up (t)-w up (t-1)|(suppress jitter), where η is the weight coefficient of the branch switching regularization term; the local training loss L is obtained by combining these values. local = L data + α·L branch + β·L switch For Z loc_raw Application switching suppression: When the branch weight W gate A time penalty is introduced when the boundary threshold is approached to avoid frequent jumps between rising / falling branches; a local Savitzky-Golay filter is used to smooth the phase, and the local short-window prediction Z is obtained after correction. loc Specifically, read the branch weight W. gate Apply temperature annealing near the threshold g T = sigmoid((logit(g)) / T), where T gradually decreases from T0 to T1. min By reducing the switching frequency, a smooth gating W can be obtained. gate_s Read Z loc_raw W gate_s , for Z loc_raw Perform minimum phase or SG filtering; set guard bands at the boundaries and event center to avoid overshoot, and output local short-window prediction Z. loc Based on Z loc Calculate the alarm indicators for local monotonicity and boundary deviation, and generate the local verification C. loc Specifically, read Z loc Calculate the monotonic constraint index M mono = mean(max(0, -dZ) loc / dx)) and boundary deviation M bnd = |Z loc -Z down The statistics at the boundary form a local verification C. loc Record H local Structure, optimizer, early stopping criterion, and optimal hyperparameters are used to generate the local modeling file L. local Zloc C loc L local Unified packaging to form local stage output P local .

[0092] Alternatively, z can be set first. true For the label water level, y branch ∈[0,1] represents the soft label for rise / fall (closer to 1 indicates that the rise branch should have more weight), then L data = 1 / ∣Ω∣∑ (i,t)∈Ω (z loc_raw (i, t)-z true (i, t)) 2 L branch = -1 / ∣Ω∣∑ (i,t)∈Ω (y branch (i, t) logw up (i, t) + (1-y) branch (i, t)) log(1-w up (i, t))), where Ω is the index space of the training sample set. To suppress frequent switching of the gating system within a short window, an L1 penalty (or a Huber variant) is added to the weight difference between adjacent time steps: L switch = 1|Ω t |∑ (i,t)∈Ωt | w up (i, t) - w up (i, t-1) |。 To avoid numerical overflow, w can be adjusted within (0, 1). up Apply a barrier: L bar = 1 / ∣Ω∣∑ (i,t) (-log(w up (i, t) + ε) - log(1 - w up (i, t) + ε), where ε is a very small positive number, such as 1e -6 L bar This is the numerical barrier regularization term for the gating weights. Local total loss L local = L data + α L branch + β L switch +μ L bar Recommended ranges for weights α, β, and μ: α ∈ [0.1, 2], β ∈ [0.01, 0.5], μ ∈ [0, 0.1]; Temperature T from T0 ∈ [2, 5], linearly or exponentially annealed to T min ∈[0.5, 1].

[0093] In another possible embodiment of this application, the process of generating spatially consistent candidate predictions may also be: reading a minute-level dataset D alignBased on cross-sectional properties, the hydraulic composite distance D is constructed from the friction distance, gradient, and roughness difference. hyd Based on the river segment topology and D hyd By filtering the physical neighborhood of each cross section, we obtain the topological neighborhood N. topo Specifically, read D align Calculate the distance s(i,j) along the river channel centerline from section i to j, and obtain the distance matrix S. mat Read minute-level dataset D align Geometric information B, empirical roughness value N, and local difference approximation of energy lines and slope I. h (i, t) = max(ε, (Z(i, t) - Z(i+1, t)) / Δs), which, after smoothing, yields the slope sequence I. h Constructing a composite metric D hyd (i, j, t) = w s ·s(i,j) / s0+w I ·∣I h (i,t)-I h (j,t)∣ / I0+w n · |N(i)-N(j)| / n0;weight(w s w I w n The hydraulic composite distance D was obtained through cross-validation and sensitivity testing. hyd With topological neighborhood N topo (i) (Select the smallest D) hyd (k neighbors). Based on the prior definition of shallow water dynamics, the split / nearest neighbor consistency test P check A candidate split or nearest neighbor is only accepted if the energy line and slope are physically plausible. Specifically, read N. topo D align For a candidate splitting threshold θ, check whether the two subsets after splitting satisfy: non-negative average slope; non-reversed energy lines; if so, accept the splitting tree rule P. tree Read D hyd Only retain those that satisfy D hyd ≤ d max If there are fewer than k nearest neighbors, then backtrack to a larger number d. max Until satisfied. Generate nearest neighbor rule P. knn P tree P knn Encapsulation as a physical conformity check P check This is available for querying all base models. Utilizing N topo With P check Generate physically reasonable baseline predictions Z at each cross-section. base Simultaneously, based on upstream signals, tributary inflows, and backwater conditions, the variable propagation time delay tau is estimated online. varThe signals from adjacent cross sections are aligned to obtain the time-delay correction sequence S. shift Specifically, read N topo P check D align Z is predicted at each cross-section using the nearest neighbor or splitting generator that has passed the test. base (KNN or tree, but subject to P) check (Constraints). Read D align By combining the signals from neighboring sections, a causal dilated convolution estimator or a DTW kernel is constructed to obtain the time-delay tau. var (i→j, t), and adjust the upstream signal according to tau var Alignment, output time delay correction sequence S shift Read Z base S shift The phase and amplitude of the basic prediction are fine-tuned to obtain the updated basic prediction Z. base_u With confidence level C base According to Z loc With Z base Construct a consistency loss L for adjacent cross sections (i, i+1). xsec By constraining the water level gradient and the monotonicity of the energy line, spatially consistent candidate Z is obtained. spa_raw Specifically, read Z loc Z base_u Construct discrete gradient G for adjacent cross sections (i, i+1). z = (Z(i)-Z(i+1)) / Δs, and define L xsec = ∑ t (∑ i (λ) g * max(0, -G) z (i, t)) + λ e * (E(i,t) -E(i+1,t)) + 2 )); where E is the energy line approximation, (·) + Representing the positive part, we obtain the consistency loss L. xsec With spatial candidate Z spa_raw (with Z) loc With Z base_u (Initial draft of the fusion). Reading D align Operating condition information (fluctuation / decline, |ΔG|, Q) L Adaptive setting (λ) g , λ e When the rise or fall of water is significant, the consistency penalty is increased, resulting in a weighted mapping W. xsec Z spa_raw With S shiftCoupling is performed to perform soft projection corrections of the boundary and gradient (enabled only when the deviation exceeds a threshold), resulting in a stable spatially consistent candidate Z. spa Specifically, read Z spa_raw W xsec Solve for the minimum modification: min ΔZ ||ΔZ||2 2 st G z (Z spa_raw +ΔZ)≥0, soft boundary constraint; use coordinate descent or projected gradient iteration to output a spatially consistent candidate Z. spa Where ΔZ represents the initial spatial prediction result Z. spa_raw The applied amplitude correction. For Z spa Apply single-step maximum change limit and boundary priority rules to generate stable candidate Z. spa_s Summary D hyd ,tau var L xsec Z spa Forming spatial stage output P spa .

[0094] In one embodiment of this application, the process of generating the final water level prediction may further include: reading a minute-level aligned dataset D. align With local stage output P local Space stage output P spa Q up Z down G, Q L B, N, and short-window statistics are integrated into the working condition embedding r. A time-blocking K-fold method is adopted, based on local short-window prediction of Z. loc Spatial Consistent Candidate Prediction Z spa Generate leak-free secondary training samples S oof Based on shallow water residuals, boundary conservation, and monotonicity, a physical regularity L is defined. phys = L mass +L mom + L boundary + L monotone ; where L mass For the mass conservation regularity term, L mom L is the momentum conservation canonical term. boundary L is the boundary condition regularization term. monotone This is a monotonicity regularization term. The calculation formula is based on discrete differences and boundary values ​​of adjacent sections, for S oof Evaluating with r yields the physical regularity R. phys With S oof As input, an r-driven conditional meta-learner H is used. meta For Z loc Zspa Adaptive weighting is performed, and the objective function includes data loss and physical regularization R. phys With cross-sectional consistency loss function L xsec Gating combination: L meta =L data +λ phys L phys +λ xsec L xsec ; where the weighting factor λ phys With λ xsec The condition is adaptively adjusted by embedding r based on the working condition. After training, the output is a fused prediction Z. hat_raw For Z hat_raw Perform a mass / momentum consistency check with the cross-section, make minimal corrections for non-compliance, and obtain the final water level prediction Z. hat With consistency mark C flag Record H meta Structure, working condition mapping, regularization weight range and convergence conditions are used to generate the fusion modeling file L. meta Z hat C flag L meta M log Summarize and form the final deliverable package P final .

[0095] In one possible embodiment of this application, a method for predicting the water level of a cascade waterway may further include:

[0096] The boundary flow, boundary water level, number of river segments, and simulation time of the cascade waterways within the basin are divided and preset.

[0097] Specifically, the research scope of the cascade waterways within the basin is determined, the upstream boundary flow rate Q and boundary water level Z are obtained, and the upstream flow rate and amplitude Q are set. i Set downstream water level and amplitude Z i Set the number of river segments B, the number of cross sections in each river segment S[B], the total simulation time T, and initialize the number of water level and flow groups Z[B, S] and Q[B, S].

[0098] A hydrodynamic model is constructed to collect and process data, generating a dataset.

[0099] Specifically, a hydrodynamic model is constructed based on the Saint-Venant equations and Bernoulli's equations. Dataset generation involves collecting and processing data based on the internal and external boundary conditions of the study basin and the operating conditions of the key watersheds to generate a dataset. The external boundary of the basin is the outer boundary of the model's computational area, and its conditions generally include flow rate and water level. The internal boundary of the basin is a specific location within the model's computational area, where changes in river geometry or hydraulic conditions lead to discontinuities in mass and energy. For example, changes in internal boundary conditions can include concentrated inflow and weir / sluice gate flow. The generated dataset D={(x i y i )} i=1 n The dataset contains n samples, each with m features, x i The input feature is x. i =( x i 1 x i 2 , ..., x i m ) is the input vector, y i It is an output variable, and it is a continuous variable.

[0100] Build a dataset optimizer to perform feature engineering and hyperparameter optimization on the generated data.

[0101] Specifically, feature engineering optimization is performed on the hierarchical sparse data model. Lasso regression using feature engineering embedding is employed to evaluate feature importance, achieving centralized optimization of the data set. Lasso: min(1 / 2n∑ i=1 n (y i -∑ j=1 p ω j x ij ) 2 +α∑ j=1 p |ω j |); where n is the number of samples, i.e., the number of samples in the dataset, p is the number of features, i.e., the number of features in the dataset, and y i x is the true target value of the i-th sample. ij ω is the j-th feature value of the i-th sample. j ∑ is the weight coefficient of the j-th feature, α is the regularization parameter, which controls the strength of the regularization term, ∑ j=1 p |ω j | is the L1 norm penalty term, which is the sum of the absolute values ​​of all feature coefficients. This term introduces sparsity, making feature selection possible. Optimizing the hyperparameters of a hierarchically dense data model can reduce the risk of overfitting or underfitting. L(θ) = 1 / n∑i=1 n (y i - y i *(θ)) 2 ; θ*=arg min θ∈θ L(θ); where L(θ) is the objective function, representing the mean squared error of the model on the validation set under the hyperparameter combination θ; θ is the hyperparameter combination, including all the hyperparameters to be optimized in the model; n is the number of samples in the validation set; y i y represents the true value of the i-th sample; i * represents the predicted value of the i-th sample; θ* represents the optimal combination of hyperparameters.

[0102] Based on the optimized dataset, multiple data-driven basic models are selected to predict channel water levels.

[0103] Specifically, multiple data-driven base models are selected to predict channel water levels. Optionally, K-nearest neighbors, decision tree models, and deep learning models are employed. For a given data point, K-nearest neighbors predict the water level by finding the k nearest training data points to that point. For example, Euclidean distance is used between two points x... i and x j The Euclidean distance between them is as follows: d(x i x j =sqrt(∑ m=1 M (x im -x jm ) 2 The problem of waterway level prediction involves continuous variables. Decision tree models can summarize decision rules from a series of labeled and feature-rich data and present these rules in a tree diagram structure, making them applicable. For the j-th feature variable x in the training set... j Using the value s as the splitting variable and splitting point, the input space is divided into two regions sequentially. This division process is then repeated for each region until the stopping condition is met. arg min j,s [min c1 ∑ xi∈R1(j,s) (y i -c1*) 2 + min c2 ∑ xi∈R2(j,s) (y i -c2*) 2 ]; where c1*=1 / n1∑ xi∈R1(j,s) y i And, c2*=1 / n2∑ xi∈R2(j,s) y iThese correspond to the average values ​​within two regions; R1(j, s) is the left sub-region, R2(j, s) is the right sub-region, c1 is the predicted value for the left region, and c2 is the predicted value for the right region. Deep learning algorithms consist of multiple neuron layers, including an input layer, one or more hidden layers, and an output layer. Neurons in each layer are connected to all neurons in the next layer, forming a fully connected network structure. By iteratively training the data through forward and backward propagation, continuously adjusting the weights and biases until the loss function converges or a preset number of iterations is reached, deep learning can learn complex mapping relationships from the dataset and use them to predict the results of new data.

[0104] An ensemble learning model is constructed to integrate the predictions of the above-mentioned excellent models, thereby improving the generalization performance of the model.

[0105] Specifically, a Stacking ensemble learning framework is constructed. This framework trains multiple base models of different types and uses a meta-learner to combine the prediction results of these base models, resulting in higher accuracy and more universal applicability in the final cascade waterway level prediction. Dataset D={(x i y i )} i=1 n Above, where x i ∈R d x i Let y represent the feature vector of the i-th sample, with dimensions d and y. i Let ∈R represent the label of the i-th sample. Based on the number of models used, M models are selected to train on the dataset D. For each base prediction model m... j This yields a prediction function f. j (x), its function is to transform the input feature vector x i Mapping to the predicted output y i j * Construct a new training set, using each base model m j For each sample x in dataset D i To make a prediction, construct the feature matrix Z, as follows: Z = {y1} 1 *,y1 2 *,…,y1 M *;y2 1 *,y2 2 *,…,y2 M *;…;y n 1 *,y n 2 *,…,y n M *}={f1(x1), f2(x1), ... f M(x1); f1(x2), f2(x2), ... f M (x2); ...; f1(x) n f2(x) n ), ...f M (x n )};where Z∈R n×M It is the newly constructed feature matrix, y i j *= f j (x i Z represents the predicted value of the j-th basic prediction model for the i-th sample. i Z represents a new feature vector of a sample. i =( y i 1 *,y i 2 *,…,y i n *). This new feature matrix Z is compared with the original label y = (y1, y2, ..., y...). n Combine them into a new dataset D'={(Z)} i y i )} i=1 N Train a meta-model g(Z) based on the new feature vector Z. i The final prediction is then made. The goal of the meta-model is to minimize the following loss function L(g), which is: L(g) = 1 / n∑ i=1 n (g(Z i) - y i ) 2 Where L(g) is the loss function of the meta-model, and g(Z) is the prediction function of the meta-model. New samples are predicted based on the fitted g(Z). For a new sample x... new Z is obtained by using the prediction model in the ensemble learning set. new The relevant formula is as follows: Z new =(f1(x new f2(x) new ), ..., f n (x new The trained meta-model g(Z) is used to predict the new feature vector to obtain the final predicted value, y. new *=g(Z new ).

[0106] The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present invention, various equivalent transformations can be made to the technical solutions of the present invention, and these equivalent transformations all fall within the protection scope of the present invention.

Claims

1. A method for predicting water levels in cascade waterways, characterized in that, include: Acquire raw monitoring data and observation metadata to generate minute-level aligned datasets; Based on minute-level aligned datasets, hysteresis modeling is performed using a pre-configured conditionalized bi-branch local model to generate local short-window predictions. By combining minute-level aligned datasets with local short-window predictions, spatially consistent candidate predictions are generated by reconstructing cross-sectional hydraulic relationships. By integrating local short-window forecasts with spatially consistent candidate forecasts, a final water level forecast is generated. Generate spatially consistent candidate predictions, including: Based on the cross-sectional attributes contained in the minute-level aligned dataset, a hydraulic composite distance is constructed to measure the physical similarity between any two cross-sections. Based on the hydraulic composite distance, a physical neighborhood is determined for each cross section, thereby generating spatially consistent candidate predictions; Generating spatially consistent candidate predictions also includes: Construct a cross-sectional consistency loss function to quantify the degree to which the water level profile along the flow path conforms to physical laws; The cross-sectional consistency loss function is applied to the optimization process of local short-window prediction. By penalizing water level profile morphology that does not conform to physical laws, spatially consistent candidate predictions are generated. Generate local short-window predictions, including: For each cross section, a conditional bi-branch local model is established, in which a rising water branch and a falling water branch are set in parallel. The dual-branch local model is trained using a minute-level aligned dataset. The rising water branch is used to specifically characterize the water level evolution characteristics during the rising water process, while the falling water branch is used to specifically characterize the water level evolution characteristics during the falling water process. Together, they generate local short-window predictions. Jointly generating local short-window forecasts includes: Path-dependent features that characterize the process and direction of hydraulic state changes are extracted from minute-level aligned datasets; path-dependent features include water level change rate, flow rate change rate, or cumulative fluctuation index. The gating mechanism built into the conditional bi-branch local model is driven by path-dependent features, and the contribution weights of the rising water branch and the falling water branch are dynamically determined by the gating mechanism. Based on the contribution weight, the outputs of the rising water branch and the falling water branch are dynamically weighted and fused to obtain local short-window predictions.

2. The method according to claim 1, characterized in that, Constructing hydraulic composite distances includes: The hydraulic composite distance is generated by jointly representing the distance along the path, the difference in hydraulic gradient, and the difference in roughness obtained from the minute-level aligned dataset.

3. The method according to claim 1, characterized in that, This further generates spatially consistent candidate predictions, including: Based on preset hydraulic criteria, establish physical consistency verification rules; When constructing a prediction model for any cross section using its physical neighborhood, the construction process of the prediction model is reviewed according to the physical consistency test rules, and only the model construction operation that meets the hydraulic criteria is accepted to obtain spatially consistent candidate predictions.

4. The method according to claim 1, characterized in that, Construct a cross-sectional consistency loss function, including: For any adjacent cross-section group, determine the discrete water level gradient G. z Discrete water level slope G z It equals the difference in water level between the two sections divided by the distance along the course; The energy line E of adjacent cross sections is approximately calculated. The energy line E is equal to the sum of the water level and velocity head of the corresponding cross section. Cross-section consistency loss function L xsec To accumulate the following expression over a predetermined number of time steps: λ g * max(0, -G) z ) + λ e * max(0, E(i) - E(i+1)) 2 Where E(i) and E(i+1) represent the energy lines of the upstream and downstream sections, respectively, and λ g and λ e These are the preset non-negative weighting coefficients.

5. The method according to claim 1, characterized in that, Also includes: A branch switching suppression term is introduced into the training objective function of the conditional bi-branch local model; the branch switching suppression term penalizes the changes in contribution weights over time.

6. The method according to claim 1, characterized in that, Generate the final water level prediction, including: Extract condition embedding vectors from minute-level aligned datasets to represent real-time hydraulic conditions; The pre-configured conditional meta-learner is driven by the condition embedding vector. By taking the condition embedding vector as input, the fusion weight of the meta-learner is dynamically adjusted to adaptively weight the local short window prediction and the spatially consistent candidate prediction to generate the final water level prediction.

Citation Information

Patent Citations

  • Real-time roughness segmentation estimation method and system

    CN116522066A

  • Channel water level change intelligent prediction method based on time sequence

    CN118171774A