Gate pump station water level prediction method of physically constrained transformer
Patent Information
- Application Number
- CN202610903950.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-23
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2046-06-23
AI Technical Summary
数据驱动模型输入单一:多数研究仅依赖历史水位时序数据进行预测,忽略了降雨汇流、上游来水、闸泵机组运行状态等核心驱动因素,导致模型无法准确捕捉水位变化的根本诱因,在极端降雨或人工调控频繁场景下预测精度大幅下降
1、实现CML降雨数据与水位预测的深度融合,大幅提升极端降雨场景预测精度。利用CML分钟级、路径平均的降雨观测优势,精准捕捉城市小流域降雨的时空异质性;相比传统雨量计驱动的模型,1小时预见期水位预测RMSE降低至0.072m,NSE提升至0.871,尤其在短历时强降雨场景下,水位峰值预测的时效性与准确性得到显著提升。
Smart Images

Figure CN122451395B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water conservancy engineering and hydrological prediction technology, and in particular to a method for predicting water levels in gate pumping stations using a physically constrained Transformer. Background Technology
[0002] Sluice gates and pumping stations are the core hubs of water conservancy engineering systems, undertaking key functions such as flood control and drainage, inter-regional water transfer, and water environment management. High-precision short-term water level prediction is a prerequisite for realizing the refined operation and scheduling of sluice gates and pumping stations, and directly determines the region's flood control and disaster reduction capabilities and water resource utilization efficiency.
[0003] The existing water level prediction technology for sluice gate pumping stations has the following main drawbacks: Data-driven models rely on a single input: most studies rely solely on historical water level time series data for prediction, ignoring core driving factors such as rainfall runoff, upstream water inflow, and the operating status of gate pump units. This results in models failing to accurately capture the fundamental causes of water level changes, and prediction accuracy drops significantly in scenarios of extreme rainfall or frequent manual intervention.
[0004] The limitations of rainfall data sources are prominent: the few models that introduce rainfall auxiliary variables all use traditional rain gauge observation data, which have coarse spatiotemporal resolution (usually 1 hour / single point observation), and cannot fully capture the spatial heterogeneity and dynamic evolution characteristics of rainfall in urban small watersheds. Especially in short-duration heavy rainfall events, it is easy to cause lag in the prediction of peak water level or amplitude deviation.
[0005] Physical hydrological models have poor applicability: Traditional physical hydrological models require extremely high integrity of geographical basic data such as topography, pipeline distribution, and watershed underlying surface. However, urban small watersheds generally suffer from sparse monitoring stations and missing basic data, making it difficult to construct physical models and calibrate parameters, resulting in poor engineering implementation.
[0006] The lack of physical constraints leads to unreasonable results: Existing deep learning prediction models mostly aim at pure data fitting, without incorporating the physical laws of hydrological processes at sluice gates and pumping stations. This easily results in non-physical predictions such as abnormal water level change rates and trends that defy common sense, making them unable to directly support engineering scheduling decisions. LSTM-based water level prediction models struggle to acquire the correlation characteristics of long-term, multi-dimensional hydrological information, and their prediction accuracy decreases significantly with increasing lead time.
[0007] Insufficient integration of control factors: Existing models rarely incorporate gate and pump operation parameters such as gate opening and pump start / stop status into the prediction framework, failing to fully consider the dominant role of human control in water level changes, resulting in insufficient prediction reliability in scenarios requiring strict control.
[0008] CML (Commercial Microwave Link) rainfall inversion technology, as an emerging rainfall monitoring method, has advantages such as high spatiotemporal resolution (minute-level / path-averaged observation), direct near-surface measurement, and stable and reliable operation. It has shown application potential in fields such as watershed runoff simulation and flash flood early warning. However, existing sluice gate and pumping station water level prediction schemes still mostly use traditional LSTM models. These models are difficult to capture the correlation characteristics of long-term, multi-dimensional hydrological information and have the drawback of a significant decrease in prediction accuracy over long lead times. Summary of the Invention
[0009] The purpose of this invention is to provide a method for predicting water levels in gate pumping stations using a physically constrained Transformer, thereby solving the aforementioned technical problems.
[0010] To achieve the above objectives, this invention provides a method for predicting water levels in gate pumping stations using a physically constrained Transformer, comprising the following steps: S1. Collect and standardize preprocessing of multi-source monitoring data; S2. Construct a high-quality multimodal time series dataset based on the preprocessed multi-source data; S3. Construct a physically constrained Transformer prediction model that integrates a physical information neural network framework; S4. Train and optimize the physical constraint Transformer prediction model based on a composite loss function that integrates numerical accuracy and physical rationality. S5. Use the trained model to perform short-term water level prediction and complete engineering application verification.
[0011] Preferably, S1 specifically includes: S11. Synchronously collect four types of core data: including CML-RSL (Received Signal Level, RSL) data, rainfall data observed by traditional rain gauges, operation and control data of gate pumping stations, and water level observation data of upstream and downstream gate pumping stations; S12. Perform standardization preprocessing on heterogeneous data: unify all data to the same time resolution and complete timestamp alignment, use Hampel filtering algorithm to filter outliers, use a combination of linear interpolation and trend fitting to fill in missing values, and perform Z-score standardization on continuous features. S13. Based on the ITU-RP.838-3 attenuation model, rainfall inversion is performed on the preprocessed CML-RSL data to obtain path-average rainfall intensity data.
[0012] Preferably, S2 specifically includes: S21. Define a three-dimensional feature space, with the first dimension being rainfall-driven features, the second dimension being artificially regulated features, and the third dimension being hydrological state features. Use feature splicing to fuse the three types of features to form a unified multi-source feature sequence. S22. Set the input time window length to... The forecast period is The dimension is extracted from the fused multi-source feature sequence through sliding window sampling. The sample, of which The total feature dimension for a single time step; S23. Divide the training set and test set in chronological order, and use the mean and standard deviation of the training set to standardize the entire dataset.
[0013] Preferably, the physical constraint Transformer prediction model constructed by S3 consists of an input layer, a three-layer Transformer encoder, a physical constraint layer, and an output layer connected in sequence. The input layer includes a linear embedding layer and a sine / cosine position encoding module, used to encode a single time step. The 1D feature is mapped to a 64-dimensional high-dimensional feature space and supplemented with temporal location information; The output layer consists of two fully connected network layers and a Sigmoid activation function, which is used to map high-dimensional features into an upstream water level prediction sequence within the actual operating water level range of the target gate pumping station.
[0014] Preferably, the three-layer Transformer encoder in S3 specifically includes: An eight-head self-attention module is used to adaptively assign weights to key time periods and core variables to capture non-linear temporal dependencies between multi-source data. FFN, consisting of two fully connected layers and a ReLU activation function, is used to mine deep semantic information of features; Residual connections and layer normalization structures are placed after the self-attention module and FFN, respectively, to alleviate gradient vanishing and accelerate model convergence.
[0015] Preferably, the physical constraint layer in S3 specifically includes: Five types of customized hydrological physical constraints are integrated, including dynamic time-shift constraints, dynamic rate constraints, rate continuity constraints, acceleration constraints, and non-negative trend constraints. These constraints are used to rationally screen and optimize the global features output by the encoder, and at the same time, corresponding physical constraint loss terms are generated to participate in model training.
[0016] Preferably, the composite loss function in S4 is composed of a weighted average of numerical accuracy loss and physical constraint loss, as shown in the formula: ; in, For mean square error loss, The total physical constraint loss is obtained by weighted summation of dynamic time shift loss, dynamic rate loss, rate continuity loss, acceleration loss, and non-negative trend loss. , All weight coefficients were determined through grid search. This is a composite loss function.
[0017] Preferably, the model training in S4 specifically includes: implementing the model on an NVIDIA RTX 3090 GPU using the PyTorch framework, selecting AdamW as the optimizer, and setting an initial learning rate of... Batch size is Mixed precision training is used to accelerate computation, and a Dropout mechanism is introduced with a dropout rate set to [value missing]. ,continuous Training will automatically terminate if the loss on the validation set does not decrease after a training cycle.
[0018] Preferably, model optimization in S4 includes hyperparameter optimization, specifically: determining the optimal hyperparameter combination through grid search, including 8-head self-attention, 3-layer encoder, and model dimensionality. Input time window length .
[0019] Preferably, S5 specifically includes: S51. Collect multi-source data in real time for the 24 hours before the time to be predicted, execute the same preprocessing process as the training phase, input the trained model, and output the upstream water level prediction sequence for the next 1-8 hours. S52. The model performance is verified using four indicators: root mean square error, mean absolute error, Pearson correlation coefficient, and Nash efficiency coefficient. The focus is on verifying the prediction effect under typical scenarios, including continuous rainfall during the plum rain season and short-duration heavy rainfall during the typhoon season. S53. Connect the forecast results to the intelligent scheduling system of gate pumping stations. The 1-4 hour forecast results are used for gate pumping station operation scheduling decisions, and the 5-8 hour forecast results are used for preliminary assessment of regional flood risk.
[0020] Therefore, the present invention employs the above-mentioned physical constraint Transformer-based method for predicting water levels in gate pumping stations, which has the following beneficial effects: 1. Achieve deep integration of CML rainfall data and water level prediction, significantly improving the prediction accuracy for extreme rainfall scenarios. Leveraging the advantages of CML's minute-level and path-averaged rainfall observations, accurately capture the spatiotemporal heterogeneity of rainfall in urban small watersheds; compared to traditional rain gauge-driven models, the RMSE of water level prediction with a 1-hour lead time is reduced to 0.072m, and the NSE is improved to 0.871. Especially in short-duration heavy rainfall scenarios, the timeliness and accuracy of water level peak prediction are significantly improved.
[0021] 2. A standardized multi-source data processing system was constructed to ensure the quality and consistency of model input. The system systematically solved the challenges of time alignment, noise filtering, and feature fusion of multi-source heterogeneous data such as CML rainfall inversion, gate pump operation, and water level monitoring, forming a complete preprocessing link from raw monitoring data to model input, effectively ensuring the consistency of data quality and model input.
[0022] 3. Achieving deep integration of physics and data-driven approaches, balancing prediction accuracy with physical plausibility. An innovative Transformer prediction model guided by physical information was designed. This model not only accurately addresses the challenges of long-term dependence on multi-source data and capturing cross-modal correlations through a self-attention mechanism, but also effectively avoids non-physical prediction results that are prone to occur in purely data-driven models through five types of customized hydrological physical constraints: dynamic time shift, dynamic rate, rate continuity, acceleration, and non-negative trend. Ultimately, this achieves synergistic optimization of "numerical accuracy, process plausibility, and consistent results."
[0023] 4. Significantly reduces reliance on basic data and improves project feasibility. No complete geographical data such as topography and pipeline distribution is required. Model construction can be completed solely based on three easily accessible monitoring data types: CML rainfall, sluice gate and pump operation, and historical water levels. This completely solves the pain point of poor applicability of traditional physical hydrological models in urban small watershed scenarios with scarce data, and possesses extremely strong engineering feasibility.
[0024] 5. Accurately matches engineering scheduling needs and fully supports water conservancy management. The model's prediction performance within a 1-4 hour lead time fully meets the requirements of hydrological forecasting standards, allowing sufficient decision-making and response time for emergency scheduling of sluice gates and pumping stations; the prediction results within a 5-8 hour lead time can be used for preliminary assessment of regional flood risk, and can fully support urban flood control, drainage, and refined water resource scheduling and management.
[0025] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0026] Figure 1 This is a technical framework diagram of the gate pump station water level prediction method based on the physical constraint Transformer of the present invention. Figure 2 This is a schematic diagram of the model architecture of the physical constraint Transformer method for predicting water levels in gate pumping stations according to the present invention. Figure 3The above is a comparison of the scatter plots of the predicted water level and the actual water level for the gate pump station using the physical constraint Transformer method of the present invention under different data-driven conditions. (a) is a comparison plot driven by CML data, and (b) is a comparison plot driven by the measured rainfall data of the ground rain gauge RG. Figure 4 The above is a scatter plot comparing the predicted and actual water levels for different forecast periods of the gate pump station water level prediction method of the physical constraint Transformer of the present invention. Among them, (a) is a comparison plot with a forecast period of 1 hour, (b) is a comparison plot with a forecast period of 2 hours, (c) is a comparison plot with a forecast period of 3 hours, and (d) is a comparison plot with a forecast period of 4 hours. Figure 5 This is a performance comparison chart of different forecast lead times for the physical constraint Transformer gate pump station water level prediction method of the present invention. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages disclosed in the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present invention and are not intended to limit the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of this application. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout.
[0028] It should be noted that the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, such as a process, method, system, product, or server that includes a series of steps or units, not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or device.
[0029] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0030] like Figures 1-5As shown, the present invention provides a method for predicting water levels in gate pumping stations using a physically constrained Transformer, comprising the following steps: S1, collecting and standardizing multi-source monitoring data; S2, constructing a high-quality multimodal time-series dataset based on the preprocessed multi-source data; S3, constructing a physically constrained Transformer prediction model that integrates a physical information neural network framework; S4, training and optimizing the physically constrained Transformer prediction model based on a composite loss function that integrates numerical accuracy and physical rationality; S5, using the trained model to perform short-term water level prediction and verifying its engineering application.
[0031] S1 specifically includes: S11, synchronously collecting four types of core data covering hydrological driving, artificial control, and status monitoring: including CML-RSL data, with a typical sampling period of 1 minute; low-resolution traditional rain gauge observation rainfall data, with a typical sampling period of 1 hour; gate and pump station operation and control data, including gate opening degree (unit: m) and pump unit start-up and shutdown status (using binary encoding: 1=open, 0=closed), with a typical sampling period of 5 minutes; upstream and downstream water level observation data of gate and pump stations, with a typical sampling period of 5 minutes, and upstream water level as the core prediction target, and downstream water level as an auxiliary feature; S12. Perform standardization preprocessing on heterogeneous data: Unify all data to the same time resolution and complete timestamp alignment. Specifically, downsample high-resolution CML-RSL data and take the average value at intervals; upsample rain gauge data and evenly distribute observations to the required higher time steps, such as unifying all data to a 5-minute time resolution and completing timestamp alignment; use the Hampel filtering algorithm, based on the median within the sliding window, to identify and replace impulse noise and extreme outliers in rainfall, water level, and gate pump status data to filter out outliers; use a combination of linear interpolation and trend fitting to complete missing values. For a small amount of data with consecutive missing values of ≤3 time steps, use linear interpolation to complete the missing values. For a large amount of data with consecutive missing values of >3 time steps, use trend fitting to complete the missing values by combining the temporal trends of adjacent time periods and the correlation of similar features; perform Z-score standardization on continuous features such as rainfall intensity, water level, and gate opening, mapping the data to a distribution with a mean of 0 and a standard deviation of 1 to eliminate the interference of dimensional differences on model training; S13. Based on the ITU-RP.838-3 attenuation model, rainfall inversion is performed on the preprocessed CML-RSL data. First, the signal baseline for rainless periods is determined by classifying sunny and rainy days. Then, the signal attenuation caused by rainfall is calculated. Next, wet antenna attenuation compensation is used to eliminate system errors caused by water accumulation on the antenna. Finally, path-averaged rainfall intensity data with a 5-minute resolution and time synchronization with the gate pump station data is obtained through inversion, and a CML rainfall intensity matrix is constructed, specifically including: Based on the sliding standard deviation (RSD) method for distinguishing between sunny and rainy weather, a time-domain sliding standard deviation method is used to perform time-by-time binary classification of sunny and rainy states on a single link, eliminating the interference of short-term random noise on the determination of sunny and rainy conditions. First, a fixed sliding time window is set, with the window length matching the resolution of the subsequent 5 minutes of data. Sixty consecutive sets of original RSL time-series sampling points are taken within the window, and the time-domain sliding standard deviation of the RSL signal is calculated window by window. The calculation formula is: ; in, The number of sampling points in a single sliding window, and , For the first The RSL level value after time preprocessing, in dBm. for t The mean RSL value within the sliding window is used at all times. The classification threshold is the 95th percentile threshold used in statistics. ,like ≤ ,determination t The time is sunny; if > ,determination t It is always raining.
[0032] The non-rainfall natural baseline immediately preceding the rainfall time was used as the baseline determination criterion. This applies to any time determined to be rainy. t At any given moment, iterate forward through the time series data and retrieve the distance. t The time with the shortest time interval and where all 5 consecutive sampling points are determined to be sunny. t 0 ,Will t 0 RSL level value after time preprocessing RSL base As t The baseline for the rainfall signal is set at any given time, with a maximum time interval of 15 minutes. If the time interval exceeds this limit, the baseline is deemed invalid, and the abnormal time series data is removed.
[0033] The measured total signal attenuation of the microwave link includes attenuation from rainfall, attenuation from water accumulation on the wet antenna, and attenuation from environmental drift, where the environmental drift attenuation has been offset by baseline compensation. The effective attenuation caused by pure rainfall is also included. The calculation formula is: ; in, for The measured total attenuation of RSL after time-mapping is expressed in dB. for The attenuation reference value corresponding to the preceding no-rain baseline level at any given time is expressed in dB.
[0034] Wet antenna attenuation is the additional signal loss caused by water film formed on the radome surface. It is a systematic error independent of rainfall path attenuation. An exponential attenuation model is used to calculate the wet antenna attenuation at a single moment. The formula is: ; in, The wet antenna saturation attenuation coefficient represents the maximum attenuation that the antenna water film can produce when the rainfall intensity approaches infinity, and is measured in dB. Based on the 26GHz link used in this embodiment... The value is 7.8dB. The rainfall response coefficient represents the rate at which the wet antenna attenuation increases with rainfall intensity, and its value is 0.068. This is the rainfall intensity index coefficient, which corrects the nonlinear relationship between rainfall intensity and attenuation, and is set to a value of 0.58. The average rainfall intensity along the path is expressed in mm / h.
[0035] Based on the built-in microwave rainfall attenuation power-law model in the ITU-R P.838-3 standard, the average rainfall intensity of the link path is inverted by inputting the compensated path rainfall attenuation. The core power-law formula is: ; in, Rainfall attenuation per unit path length, , The coefficients are related to the microwave signal frequency, polarization, and raindrop spectral distribution; therefore, the total rainfall attenuation... By means of The coefficients are obtained by integrating along the link path when the CML operating frequency is around 30GHz. ≈1, at this time, From the R The path integral can be converted into a product form, as shown in the formula: ; in, The average rainfall rate along the path, This is the total length of the CML. Using the positional integral variable along the length of the CML, the rainfall intensity can be obtained through further inversion, and the formula is as follows: ; Based on this, a two-dimensional structured CML rainfall intensity matrix is constructed. M R The matrix dimension is m OK n number of columns, rows m To monitor the number of time series steps, a single time series step corresponds to 5 minutes, and the number of columns... nThe standard matrix expression for the number of effective CML microwave links within a region is: ; in, For the first CML link, number The average rainfall intensity along the path corresponding to each 5-minute time step, in mm / h. , , Used for subsequent gate pump surface rainfall fusion verification, supplementing the associated basic data required for matrix construction.
[0036] S2 specifically includes: S21, defining a three-dimensional feature space. The first dimension is rainfall-driven features, including the CML rainfall intensity matrix and the traditional rain gauge rainfall matrix; the second dimension is artificially controlled features, namely the gate pump operation status matrix (including gate opening and pump start / stop status); the third dimension is hydrological status features, namely the upstream and downstream water level matrix of the gate pump station. Then, using a feature splicing method, the three types of features are fused along the feature dimensions to form a unified multi-source feature sequence; S22, setting the input time window length to... ,in Taking 288 time steps, corresponding to historical 24-hour data, the prediction lead time is... ,and Hour, These correspond to 12, 24, 36, and 48 time steps, respectively; samples are extracted from the fused multi-source feature sequence using a sliding window sampling method, with each sample containing the preceding data. All features at each time step, with the corresponding label being future. The measured upstream water level values at each time step, with a sample dimension of [number missing]. ,in For a single time step, the total feature dimension is [dimension], and =CML Link Count + Rainfall Count + Gate Pump Control Feature Count + Water Level Count.
[0037] S23. Divide all samples into training and test sets in a 4:1 ratio according to time sequence. Random division is prohibited to avoid leakage of time series data. Standardize the training and test sets using only the mean and standard deviation of the training set to ensure that the test set data is not involved in the calculation of any preprocessing parameters.
[0038] S3 constructs an end-to-end deep learning prediction model, with its core being a three-layer Transformer encoder architecture that integrates the PINNs (Physics-Informed Neural Networks) framework. It utilizes a self-attention mechanism to capture long-term dependencies and nonlinear correlations in multi-source data, while a physical constraint layer ensures the hydrological rationality of the prediction results. The constructed physical constraint Transformer prediction model consists of an input layer, a three-layer Transformer encoder, a physical constraint layer, and an output layer connected sequentially. The input layer is responsible for converting multi-source features into high-dimensional tensors that the Transformer can process. First, the concatenated multi-source features are input into a linear embedding layer, which then performs a linear transformation to convert the single-time-step features... The 1D feature is mapped to a 64-dimensional high-dimensional feature space, i.e., the model dimension. d model =64, then sine and cosine position encoding is added to supplement the temporal position information of the features, solving the problem that the Transformer itself cannot perceive the temporal order. The final input dimension is 64. batch size × seq len The feature tensor of ×64, where batch size For batch size, seq len The input time window length is specified. The output layer is responsible for mapping high-dimensional features to the final water level prediction. First, it compresses the global feature tensor output by the encoder to 1 dimension through two fully connected layers. Then, it uses the Sigmoid activation function to limit the predicted value to a reasonable range based on the actual operating water level of the target sluice gate pumping station, ultimately outputting the future water level prediction. The upstream water level prediction sequence is generated at each time step to complete the multi-step short-term water level prediction task.
[0039] The three-layer Transformer encoder in S3 consists of three stacked encoder layers with identical structures. It is the core module for the model to extract features and capture dependencies, specifically including: The eight-head self-attention module employs eight parallel attention heads, each independently calculating the correlation between any two time steps and any two feature dimensions in the feature sequence, outputting its own attention feature map, which is then concatenated. This module can adaptively assign higher weights to key time periods (such as periods of heavy rainfall or gate pump control switching times) and core variables (such as the operating status of highly correlated pumps), accurately capturing the nonlinear temporal dependencies between rainfall and water level, and between gate pump control and water level.
[0040] FFN (Feed-Forward Network): Consists of two fully connected layers and a ReLU activation function. It performs independent nonlinear transformations on the features output by the self-attention module to further mine the deep semantic information of the features and improve the feature representation ability of the model.
[0041] Residual connections and layer normalization: Residual connections and layer normalization structures are added after the self-attention module and FFN, respectively. On the one hand, this alleviates the gradient vanishing problem in deep network training and stabilizes the training process. On the other hand, it normalizes the feature distribution, accelerates the model convergence speed, and improves the generalization ability.
[0042] The three-layer encoder ultimately outputs a global feature tensor that integrates global temporal dependencies and cross-modal correlation information, with the dimension still being [dimensionality missing]. batch size × seq len ×64.
[0043] The physical constraint layer in S3 is the core module for achieving the fusion of physics and data-driven approaches in this invention. It integrates five types of customized hydrophysical constraints, performs rationality screening and optimization on the global features output by the encoder, and generates physical constraint loss terms to participate in model training. Specifically, it includes five types of customized hydrophysical constraints: dynamic time shift constraints, dynamic velocity constraints, velocity continuity constraints, acceleration constraints, and non-negative trend constraints. The various constraints are shown below: Dynamic time-shift constraints model the theoretical confluence time as a function of CML rainfall intensity, gate opening, and pump status, penalizing the overall time lag deviation between the predicted and measured water level sequences. This addresses the problem that traditional fixed confluence times cannot adapt to different operating conditions. Dynamic time-shift constraints penalize the overall time lag deviation between the predicted and measured water level sequences, while simultaneously adjusting the theoretical confluence time... Construct a function for the input features, that is: ; in, For small sub-neural networks, The parameter set is the CML-inverted rainfall intensity as input. Gate opening Water pump operating status Output the theoretical convergence time corresponding to the current sample, while also applying regularization constraints to limit... , , These are the physical lower and upper limits of the discrete lag step size, respectively; based on the convergence time... With sampling time step Calculate the theoretical lag steps : ; The formula for the model's prediction lag steps is: ; in, This corresponds to the discrete lag step size for the continuous confluence duration. For each lag step The corresponding probability distribution.
[0044] Dynamic time shift constraints The formula is: ; This constraint is differentiable and can simultaneously optimize the parameters of the master prediction model. With the parameters of the merging time sub-network The dynamic rate constraint sets the maximum allowable rate of change of water level as an adaptive threshold that updates dynamically with real-time hydrological conditions. It comprehensively considers multiple variables, including the current predicted water level, real-time rainfall intensity, gate opening, and pump operating status. The formula for calculating the dynamic maximum rate of change of water level is as follows: ; in, For time step index, It is the Sigmoid activation function. For learnable weight matrix, Appearing in (Superscript) represents the normalized feature. This represents the upper limit of permissible water level changes at the hydrophysical level.
[0045] Dynamic rate constraints The formula for hinge loss is as follows: ; in, To predict the total number of time steps in the water level sequence, the rate continuity constraint penalizes the second difference of the water level change rate, preventing non-physical spikes or sawtooth oscillations in the prediction curve. This constraint complements the acceleration constraint: the acceleration constraint limits the absolute amplitude of the water level change rate, while the rate continuity constraint penalizes abrupt changes in the rate of change. In this embodiment, the rate continuity constraint is constructed using the sum of squares of the second difference of the water level change rate at continuous time steps. The specific formula is as follows: ; in, For the first i Time step prediction of water level T This represents the total timing length. The smaller the value, the smoother and more continuous the water level curve is, without any abnormal fluctuations.
[0046] Acceleration constraints By limiting the absolute value of the acceleration of water level changes, frequent fluctuations in the prediction results are suppressed. First, the first... i The formula for calculating the water level acceleration at each time step is as follows: ; Acceleration constraints Defined as: ; in, This is the maximum water level acceleration allowed by hydrophysical methods. This factor can effectively reduce unrealistic and drastic fluctuations in the model output.
[0047] Non-negative trend constraint In scenarios with no drainage and negligible rainfall, the continuous downward trend of the penalized water level conforms to basic hydrophysical principles. This physical law is constrained by a conditional penalty term, as shown in the following formula: ; in, For the allowable small drop in water level, For the first i Constant drainage flow rate For the first i Rainfall intensity at any time This is an indicator function. When the conditions of no drainage and no rainfall are met within the parentheses, the function outputs a value of 1, triggering the penalty mechanism; when the conditions are not met, the output value is 0, and no additional penalty is applied.
[0048] Finally, the losses from the five independent physical constraints are weighted and summed to construct the overall physical regularization loss term, which is then used in the global training of the model. The specific calculation formula is as follows: ; in, These are the independent weighting coefficients corresponding to the five types of physical constraint losses. The optimal fixed values were determined through grid search combined with iterative optimization using measured hydrological data. These values are used to quantitatively adjust the constraint strength of each physical constraint in the overall network training, preventing excessively high weights of a single physical constraint from suppressing the data-driven fitting effect and ensuring mutual adaptation and collaborative optimization among multiple physical constraints. Based on the model training code and the measured water level dataset, the true optimal values for the five weights were experimentally calibrated as follows: =0.08, =0.005, =0.1, =0.15, =0.08.
[0049] In summary, the S3 physical constraint layer completes the physical rationality screening and correction optimization of the encoder's global features through the above five types of hydrological physical constraints, and simultaneously generates multiple sets of physical constraint loss terms, which jointly participate in the model backpropagation training with the data-driven loss. Ultimately, it achieves a deep integration of data feature learning and hydrological physical mechanisms, and comprehensively improves the accuracy of water level prediction and the physical reliability of the results.
[0050] In S4, a composite loss function that integrates numerical accuracy and physical plausibility is designed. Combined with a targeted training strategy, this achieves efficient model training and optimal parameter solving. The composite loss function is a weighted average of numerical accuracy loss and physical constraint loss, serving as the model's optimization objective. The formula is as follows: ; in, Mean squared error loss measures the numerical deviation between the predicted and measured values. The total physical constraint loss is obtained by weighted summation of dynamic time shift loss, dynamic rate loss, rate continuity loss, acceleration loss, and non-negative trend loss. , All weights were determined through grid search. Combining model training experiments and the optimal grid search results, the two global balance weights were set to... =1.0, =0.38, The loss function is composite. Model training in S4 specifically includes: implementing the model on an NVIDIA RTX 3090 GPU using the PyTorch framework, selecting AdamW as the optimizer, and setting the initial learning rate to [value missing]. ,in Take 1×10 -3 Batch size is ,in We set the value to 64, employ mixed-precision training to accelerate computation, introduce a Dropout mechanism, and set the dropout rate to [value missing]. ,in Take 0.1, when continuous Training will automatically terminate if the loss on the validation set does not decrease within a certain number of training epochs. Set to 10; Model optimization in S4 includes hyperparameter optimization, specifically: optimizing core hyperparameters of the model using a grid search method, including the number of heads in multi-head attention, the number of encoder layers, and model dimensions. Input time window length Finally, the optimal hyperparameter combination was determined to be: 8-head self-attention, 3-layer encoder, =64、 =288 (24-hour historical data).
[0051] S5 specifically includes: S51, the real-time short-term water level prediction process involves real-time collection of CML-RSL data, gate pump operation data, and upstream and downstream water level data for the 24 hours prior to the prediction time. A preprocessing process identical to the training phase is executed, and then the preprocessed multi-source features are input into the trained model, automatically outputting the upstream water level prediction sequence for the next 1-8 hours; S52, multi-dimensional model performance validation uses four core indicators: root mean square error (RMSE), mean absolute error (MAE), Pearson correlation coefficient (PCC), and Nash efficiency coefficient (NSE). Figure 5 As shown in the chart, each forecast period from 1 to 8 hours corresponds to a set of bar charts. Within each set, the four bars, from left to right, represent the root mean square error (RMSE), mean absolute error (MAE), Pearson correlation coefficient (PCC), and Nash efficiency coefficient (NSE). The model's prediction accuracy is quantified from three dimensions: numerical bias, trend fitting, and temporal correlation. The study focuses on validating the model's prediction performance under typical scenarios such as continuous rainfall during the plum rain season, short-duration heavy rainfall during the typhoon season, and low water levels and combined gate and pump control during the dry season. The driving effect differences between CML rainfall data and traditional rain gauge data are compared and analyzed. Figure 3 It can be seen that when CML inverted rainfall data is used as input, the sample prediction points are closely distributed on both sides of the ideal fitting line, with no obvious systematic shift trend. The overall prediction performance of the model is excellent. The root mean square error Pearson correlation coefficient (PCC) is 0.9450 and the Nash efficiency coefficient (NSE) is 0.8715. In contrast, when the ground rain gauge RG is used as the traditional rain gauge and the measured rainfall data of RG is used as the model input, the prediction results show that the dispersion of the prediction samples is higher, there is a slight prediction shift in the high water level range, and the core evaluation indicators all show varying degrees of deterioration. Specifically, the Pearson correlation coefficient (PCC) drops to 0.9332 and the Nash efficiency coefficient (NSE) drops to 0.8701. The performance difference between the two data sources stems from the higher spatiotemporal resolution of CML data. CML sampling intervals can reach 1 minute, accurately capturing detailed rainfall characteristics such as the start and end times of rainfall and sudden changes in rainfall intensity. In contrast, ground-based rain gauges (RG) have only a 1-hour resolution, failing to characterize the spatiotemporal heterogeneity of rainfall, ultimately resulting in a lag in the model's response to water level changes. In engineering applications, the model prediction results are integrated with the intelligent scheduling system for gate pumping stations. High-precision predictions with a 1-4 hour lead time are directly used as the basis for decisions regarding gate opening adjustments and pump start / stop scheduling. Prediction results with a 5-8 hour lead time are used for preliminary regional flood risk assessment, providing support for the early development of flood control and drainage plans.
[0052] In summary, the present invention provides a method for predicting the water level of gate pumping stations using a physically constrained Transformer, which solves the problems of low resolution of rainfall data, strong dependence on physical model data, poor physical rationality of deep learning models, and insufficient integration of gate pumping control factors in traditional technologies. It can achieve high-precision and physically reasonable water level prediction for gate pumping stations in small urban watersheds within 1-8 hours.
[0053] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for predicting water levels in gate pumping stations using a physically constrained Transformer, characterized in that, Includes the following steps: S1. Collect and standardize multi-source monitoring data, specifically including: S11. Simultaneously collect four types of core data: including CML-RSL data, rainfall data observed by traditional rain gauges, sluice gate and pumping station operation and control data, and upstream and downstream water level observation data of sluice gate and pumping stations; S12. Perform standardization preprocessing on heterogeneous data: unify all data to the same time resolution and complete timestamp alignment, use Hampel filtering algorithm to filter outliers, use a combination of linear interpolation and trend fitting to fill in missing values, and perform Z-score standardization on continuous features. S13. Based on the ITU-RP.838-3 attenuation model, rainfall inversion is performed on the preprocessed CML-RSL data to obtain the path-averaged rainfall intensity data; S2. Construct a high-quality multimodal time series dataset based on the preprocessed multi-source data, specifically including: S21. Define a three-dimensional feature space. The first dimension is rainfall-driven features, the second dimension is artificial control features, namely the gate and pump operation status matrix, which includes gate opening and pump start and stop status, and the third dimension is hydrological status features. The three types of features are fused together by feature splicing to form a unified multi-source feature sequence. S22. Set the input time window length to... The forecast period is The dimension is extracted from the fused multi-source feature sequence through sliding window sampling. The sample, of which The total feature dimension for a single time step; S23. Divide the training set and test set in chronological order, and use the mean and standard deviation of the training set to standardize the entire dataset. S3. Construct a physically constrained Transformer prediction model that integrates a physical information neural network framework, wherein the physical constraint layer specifically includes: Five types of customized hydrological physical constraints are integrated, including dynamic time-shift constraints, dynamic rate constraints, rate continuity constraints, acceleration constraints, and non-negative trend constraints. The global features output by the encoder are rationally screened and optimized, and corresponding physical constraint loss terms are generated to participate in model training. The dynamic time-shift constraint models the theoretical runoff time as a function of CML rainfall intensity, gate opening, and pump status, where the theoretical runoff time is... ,in, For small sub-neural networks, The parameter set is the CML-inverted rainfall intensity as input. Gate opening Water pump operating status The dynamic rate constraint sets the maximum allowable rate of change of water level as an adaptive threshold that is dynamically updated in accordance with real-time hydrological conditions; the rate continuity constraint is constructed by using the second-order difference sum of squares of water level variability at continuous time intervals to penalize abrupt rate changes; the acceleration constraint limits the absolute value of the acceleration of water level changes; the non-negative trend constraint penalizes the continuous downward trend of water level in scenarios with no drainage and negligible rainfall. S4. Train and optimize the physical constraint Transformer prediction model based on a composite loss function that integrates numerical accuracy and physical rationality. S5. Use the trained model to perform short-term water level prediction and complete engineering application verification.
2. The method for predicting the water level of a gate pumping station using a physically constrained Transformer according to claim 1, characterized in that: The S3-built physical constraint Transformer prediction model consists of an input layer, a three-layer Transformer encoder, a physical constraint layer, and an output layer connected in sequence. The input layer includes a linear embedding layer and a sine / cosine position encoding module, used to encode a single time step. The 1D feature is mapped to a 64-dimensional high-dimensional feature space and supplemented with temporal location information; The output layer consists of two fully connected network layers and a Sigmoid activation function, which is used to map high-dimensional features into an upstream water level prediction sequence within the actual operating water level range of the target gate pumping station.
3. The method for predicting the water level of a gate pumping station using a physically constrained Transformer according to claim 2, characterized in that, The three-layer Transformer encoder in S3 specifically includes: An eight-head self-attention module is used to adaptively assign weights to key time periods and core variables to capture non-linear temporal dependencies between multi-source data. FFN, consisting of two fully connected layers and a ReLU activation function, is used to mine deep semantic information of features; Residual connections and layer normalization structures are placed after the self-attention module and FFN, respectively, to alleviate gradient vanishing and accelerate model convergence.
4. The method for predicting the water level of a gate pumping station using a physically constrained Transformer according to claim 1, characterized in that: The composite loss function in S4 is composed of a weighted average of numerical accuracy loss and physical constraint loss, and the formula is as follows: ; in, For mean square error loss, The total physical constraint loss is obtained by weighted summation of dynamic time shift loss, dynamic rate loss, rate continuity loss, acceleration loss, and non-negative trend loss. , All weight coefficients were determined through grid search. This is a composite loss function.
5. The method for predicting the water level of a gate pumping station using a physically constrained Transformer according to claim 1, characterized in that, The model training in S4 specifically includes: implementing the model on an NVIDIA RTX 3090 GPU using the PyTorch framework, selecting AdamW as the optimizer, and setting an initial learning rate of... Batch size is Mixed precision training is used to accelerate computation, and a Dropout mechanism is introduced with a dropout rate set to [value missing]. ,continuous Training will automatically terminate if the loss on the validation set does not decrease after a training cycle.
6. The method for predicting the water level of a gate pumping station using a physically constrained Transformer according to claim 1, characterized in that, Model optimization in S4 includes hyperparameter optimization, specifically: determining the optimal hyperparameter combination using a grid search method, including 8-head self-attention, 3-layer encoder, and model dimensionality. Input time window length .
7. The method for predicting the water level of a gate pumping station using a physically constrained Transformer according to claim 1, characterized in that, S5 specifically includes: S51. Collect multi-source data in real time for the 24 hours before the time to be predicted, execute the same preprocessing process as the training phase, input the trained model, and output the upstream water level prediction sequence for the next 1-8 hours. S52. The model performance is verified using four indicators: root mean square error, mean absolute error, Pearson correlation coefficient, and Nash efficiency coefficient. The focus is on verifying the prediction effect under typical scenarios, including continuous rainfall during the plum rain season and short-duration heavy rainfall during the typhoon season. S53. Connect the forecast results to the intelligent scheduling system of gate pumping stations. The 1-4 hour forecast results are used for gate pumping station operation scheduling decisions, and the 5-8 hour forecast results are used for preliminary assessment of regional flood risk.