Graph convolution and Transform-based cascade reservoir water temperature prediction method
By combining graph convolution and Transformer models, the problems of spatial correlation, heterogeneous data adaptation, and long-term time series modeling in cascade reservoir water temperature prediction are solved, achieving more accurate and stable water temperature prediction, which is suitable for the scientific scheduling and ecological protection of cascade reservoirs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA THREE GORGES CORPORATION
- Filing Date
- 2026-01-06
- Publication Date
- 2026-05-12
AI Technical Summary
Traditional reservoir water temperature prediction methods struggle to accurately capture the spatial correlation between multiple reservoirs, integrate external factors such as boundary conditions, adapt to heterogeneous data, and handle long-term time-series dependencies in cascade reservoir scenarios, resulting in insufficient prediction accuracy and applicability.
This paper adopts a method that combines graph convolution and Transformer models. The graph convolution network captures the spatial dependencies between reservoirs, the Transformer captures the long-term temporal dependencies, and the external conditions are fused through a gating fusion mechanism to achieve unified modeling of heterogeneous data.
It improves the accuracy and applicability of water temperature prediction for cascade reservoirs, effectively simulates and predicts the vertical water temperature distribution in front of the dam, reduces the complexity of data preprocessing, and enhances the stability and reliability of prediction results.
Smart Images

Figure CN122019992A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water conservancy engineering technology, and in particular to a method for predicting the water temperature of cascade reservoirs based on graph convolution and Transformer. Background Technology
[0002] Reservoir water temperature is an important parameter affecting the aquatic ecological environment and the safety of hydraulic structures. Its distribution pattern is directly related to fish reproduction in the basin, eutrophication control, and temperature stress safety of dam concrete structures. It is one of the core reference bases for cascade reservoir scheduling, ecological protection, and engineering operation and maintenance.
[0003] Currently, traditional methods for predicting reservoir water temperature are mainly based on physical models or single time-series models. However, in the context of cascade reservoirs, these methods have significant limitations in application: (1) It is difficult to accurately capture the spatial correlation between multiple reservoirs: cascade reservoirs form an upstream-downstream coupling relationship through water flow. The temperature of the outflow from the upstream reservoir will directly affect the water temperature distribution of the downstream reservoir. However, traditional methods are mostly modeled for single reservoirs and cannot effectively depict the spatial transmission effect between reservoirs. (2) Limited ability to integrate external factors such as boundary conditions: boundary conditions such as water level and outflow are key factors affecting water temperature changes, but traditional models have a relatively simple way of integrating these external features with water temperature features, making it difficult to fully explore the correlation between the two. (3) It is impossible to handle the situation where different reservoirs have different numbers of vertical observation points at the same time: the hydrological observation conditions of different cascade reservoirs are different, and the number of vertical water temperature observation points is often inconsistent. Traditional models are difficult to adapt to the unified modeling requirements of such heterogeneous data. (4) Insufficient ability to model long-term time-series dependencies: Water temperature change is a multi-time-scale coupled process. When traditional time-series models process long-term water temperature data, they are prone to the problem of losing time-series information, making it difficult to accurately predict the medium- and long-term water temperature change trend.
[0004] To address the aforementioned issues, there is an urgent need in the relevant technical field for a water temperature prediction method that can simultaneously consider spatial correlation of cascade reservoirs, adaptation of heterogeneous data, fusion of external conditions, and long-term time-series modeling. This would improve the accuracy and applicability of water temperature prediction for cascade reservoirs, and provide more reliable technical support for the scientific scheduling and ecological protection of cascade reservoirs. Summary of the Invention
[0005] The purpose of this invention is to overcome the above-mentioned shortcomings and provide a method for predicting the water temperature of cascade reservoirs based on graph convolution and Transformer, which can effectively simulate and predict the vertical water temperature distribution in front of the dam of cascade reservoirs.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a method for predicting the water temperature of cascade reservoirs based on graph convolution and Transformer, comprising the following steps: Step 1: Collect historical vertical water temperature, water level, outflow, and unit intake elevation data of the cascade reservoirs, and convert and store them in the correct format. Step 2: Build a graph convolutional model and capture the spatial dependencies between reservoirs through a graph convolutional network; Step 3: Build a Transformer model and use Transformer to capture long-term temporal dependencies; Step 4: Perform inverse normalization and independent decoding on the output of the Transformer model; Step 5: Train the model and verify the model error using a test set; Step 6: Input the preprocessed data into the trained model to obtain the vertical water temperature prediction results.
[0007] Preferably, the format conversion in step 1 specifically includes: converting the elevation-water temperature data format of the vertical water temperature in front of the reservoir dam into the water depth-water temperature data format, with the surface water temperature elevation recorded as 0m, and extracting water temperature data at fixed intervals until a suitable depth is obtained; subtracting the unit intake bottom plate elevation data from the water level data of each cascade reservoir to obtain the intake submersion depth.
[0008] Preferably, the storage in step 1 specifically involves: storing the vertical water temperature data of each cascade reservoir separately as an Excel file, and storing the inlet submersion depth and outflow rate as an Excel file of boundary conditions.
[0009] Preferably, step 2 specifically includes the following sub-steps: Step 2.1: Normalize the data to convert it to the range of 0 to 1; Step 2.2: Construct the input and output datasets using the sliding window technique, and divide them into training and validation sets; Step 2.3: Build the RevIN layer to fix the mean and variance of the time series to a uniform distribution type; Step 2.4: Map the vertical water temperature characteristics and boundary condition characteristics respectively to make the characteristic dimensions of different reservoirs consistent; Step 2.5: Construct a graph convolutional neural network and incorporate boundary conditions through a gating fusion mechanism.
[0010] Preferably, the specific process of constructing the input and output datasets in step 2.2 is as follows: First, the vertical water temperature of each reservoir is divided into sliding window segments. Since the number of vertical water temperature points varies from reservoir to reservoir, the vertical water temperature datasets of all reservoirs are merged along the dimension of the number of temperature points after the segmentation, and the number of vertical water temperature variables for each reservoir is recorded. Then, the boundary variables of each reservoir are divided into sliding window segments, and the data are merged along the dimension of the number of variables, and the number of dimensions of the variables is recorded. Finally, the vertical water temperature dataset is formed. If there are two cascade reservoirs, the resulting dimension is [seq_len, R0_Temp_num + R1_Temp_num]; the boundary data dimension is [seq_len, R0_BC_num + R1_BC_num].
[0011] Preferably, step 2.4 is performed as follows: Since the number of vertical water temperatures may vary for each reservoir, to ensure consistency in the dimensionality of the input data, different feedforward neural networks are used to map the vertical water temperatures of each reservoir to the same dimension, as shown in the following formula: nn.Linear(in_channel[k],hidden_channel); Where: in_channel[k] is the number of vertical water temperatures in reservoir k, and hidden_channel is the mapped dimension; For each reservoir with different boundary dimensions, the same method is used to map the boundary conditions of different dimensions to the same dimension.
[0012] Preferably, step 2.5 is performed as follows: First, construct the adjacency matrix. For cascade reservoirs, the adjacency matrix is a one-way connection matrix. The adjacency matrix for the four reservoirs is as follows: ; Then, the adjacency matrix is normalized, and graph convolution propagation is performed: ; ; In the formula: A is the adjacency matrix, I is the identity matrix, and D is the degree matrix; For the first Layer node characteristics, This is the weight matrix. For bias terms, For activation functions; To incorporate boundary conditions into the graph convolution model, a gating fusion mechanism is employed: ; ; In the formula: g is the gating coefficient in the gating fusion mechanism; E is the external boundary condition feature; For the gated weight matrix, This indicates element-wise multiplication.
[0013] Preferably, the Transformer model in step 3 includes positional encoding and a self-attention mechanism. Positional encoding reflects temporal information, and the self-attention mechanism captures temporal dependencies.
[0014] Preferably, in step 4, inverse normalization is implemented through a RevIN layer, and independent decoding employs a feedforward neural network. The decoding formula is as follows: nn.Linear(hidden_channel,out_channel[k]); Where: hidden_channel is the dimension after RevIN layer denormalization, out_channel[k] is the number of vertical water temperatures in reservoir k; finally, denormalization of the 0-1 interval is performed separately for each reservoir.
[0015] Preferably, in step 5, after the model is trained, the model error is verified using a test set. The test set results are displayed, and the verification set results are shown using a two-dimensional cloud map drawing method, and compared with the true value cloud map.
[0016] Beneficial effects of this invention: 1. This invention accurately captures the spatial dependencies of cascade reservoirs and enhances the ability to model spatial relationships: By constructing a unidirectional adjacency matrix adapted to the connectivity characteristics of cascade reservoirs and combining it with the spatial feature extraction capabilities of graph convolutional networks, it effectively characterizes the transmission influence of upstream reservoir discharge flow on downstream reservoir water temperature, solving the problem that traditional methods are difficult to model the spatial coupling effect between reservoirs, and making water temperature prediction more consistent with the actual hydrological relationship patterns of cascade reservoirs.
[0017] 2. This invention efficiently mines long-term time-series dependencies and optimizes medium- and long-term prediction results: By leveraging the multi-head self-attention mechanism and positional encoding function of the Transformer model, it fully mines the evolutionary patterns of water temperature data over long periods, avoiding the information loss problem when traditional time-series models process long-term time-series data, and significantly improving the prediction accuracy of medium- and long-term water temperature change trends in cascade reservoirs.
[0018] 3. This invention achieves unified modeling of heterogeneous data and adapts to complex observation conditions: By using a feedforward neural network to perform unified dimensional mapping on the vertical water temperature characteristics and boundary condition characteristics of different reservoirs, it can be compatible with heterogeneous data scenarios where the number of vertical observation points in each reservoir is inconsistent. It does not require mandatory unified processing of the original observation data, reduces the complexity of data preprocessing, and improves the practical applicability of the method.
[0019] 4. This invention enhances the fusion effect of external factors and improves the comprehensiveness of prediction: It adopts a gated fusion mechanism to dynamically adjust the fusion ratio of graph convolution node features and boundary condition features such as water level and outflow, and automatically judges the contribution of different external factors to water temperature changes. Compared with the traditional simple splicing fusion method, it can more fully explore the correlation between external conditions and water temperature, and further improve the prediction accuracy.
[0020] 5. This invention ensures data distribution consistency and reduces system errors: The input data is normalized by the RevIN layer, fixing the mean and variance of the time series to a uniform distribution type. At the same time, combined with the inverse normalization operation after independent decoding, the prediction error caused by data distribution differences is effectively reduced, ensuring the prediction stability of the model on different time periods and different reservoir data.
[0021] 6. The modeling process of this invention is standardized and efficient, and is easy to apply in engineering: the process of data preprocessing, model training and prediction inference is clear and reproducible. Vertical water temperature and boundary condition data are uniformly stored in Excel files, making data management convenient. After model training, the preprocessed data can be directly received to output the vertical water temperature prediction results. The operation is simple and easy to promote and apply in the practice of cascade reservoir scheduling.
[0022] 7. The prediction results of this invention are intuitive and easy to understand, supporting scientific decision-making: By displaying the comparison between the prediction results and the actual values through a two-dimensional cloud map, the prediction effect of the vertical distribution of water temperature can be presented intuitively, which facilitates technicians to quickly evaluate the model performance. At the same time, it provides clear and reliable technical basis for decisions such as cascade reservoir scheduling and ecological protection. Attached Figure Description
[0023] Figure 1 A flowchart of the method provided in an embodiment of the present invention; Figure 2 This is a cloud map of the true values of the vertical water temperature verification set of the R0 reservoir provided in Embodiment 1 of the present invention; Figure 3 This is a cloud map of the true values of the vertical water temperature verification set of Reservoir R1 provided in Embodiment 1 of the present invention. Detailed Implementation
[0024] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0025] Example 1: As Figure 1 As shown, a method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer includes the following steps: Step 1: Collect historical data on vertical water temperature, water level, outflow, and unit intake elevation of the cascade reservoirs. The vertical water temperature data in front of the reservoir dam is in elevation-temperature data format. To ensure that the input data meets the model requirements, the data needs to be converted to a fixed format, namely water depth-temperature data. The main steps are as follows: Record the surface water temperature elevation as 0m, and take water temperature data at fixed intervals. Repeat this process until a suitable depth is obtained. Subtract the unit intake elevation data from the water level data of each cascade reservoir to obtain the intake submersion depth. Save the vertical water temperature data of each cascade reservoir as a separate Excel file, and save the submersion depth and outflow as a boundary condition Excel file.
[0026] Step 2: After formatting the data, begin building the graph convolutional model. The graph convolutional network is used to capture the spatial dependencies between reservoirs, mainly as follows: ① First, the data is normalized to the range of 0 to 1. The formula used is as follows;
[0027] In the formula: T norm This is the normalized vertical water temperature value.
[0028] ② After considering the input and output step sizes, the sliding window technique is used to construct the input and output datasets: First, the vertical water temperature of each reservoir is divided into sliding window segments. Since the number of vertical water temperature points varies from reservoir to reservoir, the vertical water temperature datasets of all reservoirs are merged along the dimension of the number of temperature points, and the number of vertical water temperature variables for each reservoir is recorded. Similarly, the boundary variables of each reservoir are divided into sliding window segments, and then merged along the dimension of the number of variables, recording the number of dimensions of the variables. Finally, the vertical water temperature dataset is formed. Taking two cascade reservoirs as an example, the resulting dimension is [seq_len, R0_Temp_num + R1_Temp_num]; the boundary data dimension is [seq_len, R0_BC_num + R1_BC_num]. Finally, the obtained dataset is divided into training and validation sets.
[0029] ③Build a RevIN layer to fix the mean and variance of the time series into a uniform distribution type, thereby improving model accuracy and reducing the impact of random variations on the results.
[0030] ④ Vertical water temperature feature mapping. Since the number of vertical water temperature features may vary for each reservoir, to ensure consistency in the dimensionality of the input data, different feedforward neural networks are used to map the vertical water temperature of each reservoir to the same dimension, as shown in the following formula: nn.Linear(in_channel[k],hidden_channel) Where: in_channel[k] is the number of vertical water temperatures in reservoir k, and hidden_channel is the mapped dimension.
[0031] Similarly, for each reservoir with different boundary dimensions, the same method is used to map the boundary conditions of different dimensions to the same dimension.
[0032] ⑤ Construct a graph convolutional neural network. First, construct the adjacency matrix. For a cascade reservoir system, the adjacency matrix is a one-way connection matrix. For example, the adjacency matrix for four reservoirs is:
[0033] Then, the adjacency matrix is normalized, and graph convolution propagation is performed: ; ; In the formula: A is the adjacency matrix, I is the identity matrix, and D is the degree matrix; For the first Layer node characteristics, This is the weight matrix. For bias terms, For activation functions; To incorporate boundary conditions into the graph convolution model, a gating fusion mechanism is employed: ; ; In the formula: E represents the external boundary condition characteristics; For the gated weight matrix, This indicates element-wise multiplication.
[0034] Step 3: Build a Transformer model, which mainly includes positional encoding and self-attention mechanism. Use Transformer to capture long-term temporal dependencies. Transformer modeling is relatively mature, so it will not be elaborated here.
[0035] Step 4: After the Transformer model outputs the results, it undergoes inverse normalization through the RevIN layer. Then, each reservoir is decoded independently, primarily using a feedforward neural network for independent decoding. nn.Linear(hidden_channel,out_channel[k]) Where: hidden_channel is the dimension after denormalization of the RevIN layer, and out_channel[k] is the number of vertical water temperatures in reservoir k. Finally, denormalization of the 0-1 interval is performed separately for each reservoir.
[0036] Step 5: Train and test the model. After the model is trained, the test set is used to verify the model error. The test set results are displayed using a two-dimensional cloud plot method and compared with the true value cloud plot.
[0037] Step 6, Model Prediction: Prepare the data into an input format and feed it into the trained model to obtain the vertical water temperature prediction results.
[0038] Example 2: A method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer, comprising the following steps: Step 1: Taking the last two cascade reservoirs in the lower reaches of the Jinsha River as examples, we collected the temperature chain data in front of the dams of reservoirs R0 and R1 from January to May 2020 to 2023. We organized the data of the vertical temperature chain monitoring in front of the reservoir dams. Since the vertical temperature chain data of the reservoirs is generally in the form of elevation-temperature structure, it needs to be converted into a water depth-temperature structure. With the surface water depth as 0m as the benchmark, water temperature data is extracted at equal intervals of water depth. Step 2: Normalize the data for each year to the 0-1 interval, and then use the sliding window technique to select the length of the input time variable. Here, the data of the first 5 days is selected. For the time series length of the output variable, 1 day is selected as the predicted output. After traversing all the data, the input and output datasets of each reservoir are obtained. The vertical water temperature of each reservoir is fused in the water temperature dimension. Similarly, the boundary conditions are fused. Finally, the training set and validation set data are divided. Step 3: Model building. First, build the RevIN layer. Since the number of vertical water temperature points is inconsistent in each reservoir, map the vertical water temperature dimension of each reservoir to the same dimension. Similarly, map the boundary conditions to the same dimension. Build a graph convolutional network model and integrate the gating mechanism. Then, use Transformer to capture temporal dependencies. After denormalization through the RevIN layer, decode each reservoir separately. Finally, perform denormalization in the 0-1 interval to restore the result.
[0039] Step 4: Train the model, validate it, and calculate the model error.
[0040] Step 5: Using the validation set data, input the validation set data into the trained model to obtain a comparison between the actual value and the predicted value of the reservoir R0 validation set. Figure 2 Comparison of actual and predicted values of the R0 validation set for the reservoir. Figure 3 By comparing the actual values with the predicted values, it can be seen that the model predicted the validation set situation quite well.
[0041] The above embodiments are merely preferred technical solutions of the present invention and should not be considered as limitations on the present invention. The scope of protection of the present invention should be limited to the technical solutions described in the claims, including equivalent substitutions of the technical features described in the claims. That is, equivalent substitutions and improvements within this scope are also within the scope of protection of the present invention.
Claims
1. A method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer, characterized in that, Includes the following steps: Step 1: Collect historical vertical water temperature, water level, outflow, and unit intake elevation data of the cascade reservoirs, and convert and store them in the correct format. Step 2: Build a graph convolutional model and capture the spatial dependencies between reservoirs through a graph convolutional network; Step 3: Build a Transformer model and use Transformer to capture long-term temporal dependencies; Step 4: Perform inverse normalization and independent decoding on the output of the Transformer model; Step 5: Train the model and verify the model error using a test set; Step 6: Input the preprocessed data into the trained model to obtain the vertical water temperature prediction results.
2. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer as described in claim 1, characterized in that, The format conversion in step 1 specifically includes: converting the elevation-water temperature data format of the vertical water temperature in front of the reservoir dam into the water depth-water temperature data format, with the surface water temperature elevation recorded as 0m, and extracting water temperature data at fixed intervals until a suitable depth is obtained; subtracting the unit intake bottom plate elevation data from the water level data of each cascade reservoir to obtain the intake submersion depth.
3. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer as described in claim 1, characterized in that, The storage described in step 1 specifically involves storing the vertical water temperature data of each cascade reservoir separately as an Excel file, and storing the inlet submersion depth and outflow rate as an Excel file containing the boundary conditions.
4. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer as described in claim 1, characterized in that, Step 2 specifically includes the following sub-steps: Step 2.1: Normalize the data to convert it to the range of 0 to 1; Step 2.2: Construct the input and output datasets using the sliding window technique, and divide them into training and validation sets; Step 2.3: Build the RevIN layer to fix the mean and variance of the time series to a uniform distribution type; Step 2.4: Map the vertical water temperature characteristics and boundary condition characteristics respectively to make the characteristic dimensions of different reservoirs consistent; Step 2.5: Construct a graph convolutional neural network and incorporate boundary conditions through a gating fusion mechanism.
5. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer according to claim 4, characterized in that, The specific process of constructing the input and output datasets in step 2.2 is as follows: First, the vertical water temperature of each reservoir is divided into sliding windows. Since the number of vertical water temperature points in each reservoir is different, after the division, the vertical water temperature datasets of all reservoirs are merged in terms of the number of temperature points, and the number of vertical water temperature variables in each reservoir is recorded. The boundary variables of each reservoir are divided into sliding window segments. After the segments are divided, they are merged along the dimension of the number of variables, and the number of dimensions of the variables is recorded. Finally, a vertical water temperature dataset is formed. If there are two cascade reservoirs, the resulting dimension is [seq_len, R0_Temp_num + R1_Temp_num]; the boundary data dimension is [seq_len, R0_BC_num + R1_BC_num].
6. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer according to claim 4, characterized in that, The specific process of step 2.4 is as follows: Since the number of vertical water temperatures may vary for each reservoir, to ensure consistency in the dimensionality of the input data, different feedforward neural networks are used to map the vertical water temperatures of each reservoir to the same dimension, as shown in the following formula: nn.Linear(in_channel[k],hidden_channel); Where: in_channel[k] is the number of vertical water temperatures in reservoir k, and hidden_channel is the mapped dimension; For each reservoir with different boundary dimensions, the same method is used to map the boundary conditions of different dimensions to the same dimension.
7. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer according to claim 4, characterized in that, The specific process of step 2.5 is as follows: First, construct the adjacency matrix. For cascade reservoirs, the adjacency matrix is a one-way connection matrix. The adjacency matrix for the four reservoirs is as follows: ; Then, the adjacency matrix is normalized, and graph convolution propagation is performed: ; ; In the formula: A is the adjacency matrix, I is the identity matrix, and D is the degree matrix; For the first Layer node characteristics, This is the weight matrix. For bias terms, For activation functions; To incorporate boundary conditions into the graph convolution model, a gating fusion mechanism is employed: ; ; In the formula: g is the gating coefficient in the gating fusion mechanism; E is the external boundary condition feature; For the gated weight matrix, This indicates element-wise multiplication.
8. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer according to claim 1, characterized in that, The Transformer model in step 3 includes positional encoding and a self-attention mechanism. Positional encoding reflects temporal information, and the self-attention mechanism captures temporal dependencies.
9. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer according to claim 1, characterized in that, In step 4, inverse normalization is implemented through the RevIN layer, and independent decoding uses a feedforward neural network. The decoding formula is as follows: nn.Linear(hidden_channel,out_channel[k]); Where: hidden_channel is the dimension after RevIN layer denormalization, out_channel[k] is the number of vertical water temperatures in reservoir k; finally, denormalization of the 0-1 interval is performed separately for each reservoir.
10. The method for predicting water temperature in cascade reservoirs based on graph convolution and Transformer according to claim 1, characterized in that, In step 5, after the model is trained, the model error is verified using a test set. The test set results are displayed, and the verification set results are shown using a two-dimensional cloud plot drawing method, and compared with the true value cloud plot.