Training method and using method of medium and long term runoff prediction model and related device

By training a Seq2Seq model that combines multi-scale decomposition and attention weighting with a deep learning model, the problem of insufficient accuracy in medium- and long-term runoff forecasts is solved. This approach effectively captures the multi-scale characteristics and long-term dependencies of runoff data, thereby improving forecast accuracy and lead time.

CN121328619APending Publication Date: 2026-01-13YUNNAN POWER GRID CO LTD ELECTRIC POWER RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510892108.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Existing medium- and long-term runoff forecasting methods suffer from insufficient forecast accuracy, making it difficult to effectively capture the complexity and multi-scale characteristics of runoff data, and increasing forecast uncertainty when the lead time is long.

Method used

A Seq2Seq model combining multi-scale decomposition and attention weighting deep learning model is used for training. Historical temperature and precipitation sequences are decomposed by maximum overlap discrete wavelet transform (MODWT). Medium- and long-term runoff prediction is performed using an LSTM-based Seq2Seq model, and the attention weights are dynamically adjusted to improve prediction accuracy.

Benefits of technology

It effectively captures the multi-scale characteristics and long-term dependencies of runoff data, improves the accuracy and lead time of medium- and long-term runoff forecasts, and provides more accurate predictions of future runoff.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121328619A_ABST
    Figure CN121328619A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a medium-and-long-term runoff prediction model training method, a medium-and-long-term runoff prediction model using method and a related device, and the training method comprises the steps: obtaining sample data which comprises a historical temperature sequence, a historical rainfall sequence and a historical runoff sequence; performing multi-scale decomposition on the historical temperature sequence and the historical rainfall sequence to obtain a decomposed historical temperature sequence and a decomposed historical rainfall sequence; carrying out attention weighting processing on the decomposed historical temperature sequence and historical rainfall sequence to obtain a weighted aggregation sequence; and performing model training of medium and long term runoff prediction by using a preset deep learning model, the historical runoff sequence and the weighted aggregation sequence to obtain a target medium and long term runoff prediction model. By adopting the mode, the advantages of multi-modal identification and deep learning are combined, the obtained medium and long-term runoff prediction model can effectively capture the multi-scale characteristics and long-term dependency relationship of runoff data during future medium and long-term runoff prediction, and the prediction precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of hydropower station runoff forecasting technology, and in particular to a training method, usage method, and related apparatus for a medium- and long-term runoff forecasting model. Background Technology

[0002] Hydropower stations, as an important component of clean energy, occupy a significant position in the global energy structure. The power generation efficiency and economic viability of hydropower stations are highly dependent on reservoir runoff conditions, and medium- to long-term runoff forecasting is one of the core aspects of hydropower station operation and management. Accurate runoff forecasts provide a scientific basis for reservoir scheduling, power generation planning, flood control and disaster reduction, and optimal water resource allocation, thereby significantly improving the economic and social benefits of hydropower stations.

[0003] In power system dispatching, medium- and long-term runoff forecasts are the foundation for formulating power generation plans. By predicting runoff conditions for the next few months, hydropower stations can rationally schedule power generation tasks, optimize reservoir storage and release strategies, and avoid insufficient power generation or waste of water resources due to runoff fluctuations.

[0004] Furthermore, medium- and long-term runoff forecasts are of great significance for flood control and disaster reduction. During the flood season, accurate runoff predictions can help reservoirs free up storage capacity in advance, reducing the risk of flooding; during the dry season, they can ensure downstream ecological water use and agricultural irrigation. Therefore, improving the accuracy and reliability of medium- and long-term runoff forecasts is of great importance for ensuring the safe operation of hydropower stations and promoting the sustainable use of water resources.

[0005] Despite the undeniable importance of medium- and long-term runoff forecasting, its implementation faces numerous challenges.

[0006] First, runoff data exhibits high nonlinearity and nonstationarity. Runoff processes are influenced by a variety of factors, including climate conditions (such as precipitation and temperature), topographic features, vegetation cover, and human activities. The interaction of these factors results in complex dynamic characteristics in runoff data. Traditional time series analysis methods struggle to effectively capture this complexity, leading to insufficient forecast accuracy.

[0007] Secondly, medium- and long-term runoff forecasts have long lead times, and with the extension of the lead time, the uncertainty of the forecast increases significantly. Factors such as meteorological forecast errors, model parameter uncertainties, and climate change all have a significant impact on the forecast results. Furthermore, runoff data typically contains variations across multiple time scales, such as interannual variability, seasonal fluctuations, and short-term fluctuations. How to extract effective information from multi-scale data and use it for long-term forecasting is another major challenge facing medium- and long-term runoff forecasting.

[0008] Currently, the main methods for medium- and long-term runoff forecasting are physical model-based methods. These methods simulate runoff processes by establishing hydrological models. While relying on a deep understanding of watershed hydrological processes, they often face challenges in practical applications, such as difficulty in determining parameters and high computational complexity. Furthermore, physical models require high accuracy from input data (such as meteorological data), and errors in meteorological forecasts directly affect the accuracy of runoff forecasts.

[0009] In summary, current runoff forecasting methods still suffer from insufficient forecast accuracy, and these methods need to be improved. Summary of the Invention

[0010] The main objective of this invention is to provide a training method, usage method, and related apparatus for a medium- to long-term runoff prediction model, which can solve the problem that existing runoff forecasting methods still have insufficient forecasting accuracy.

[0011] To achieve the above objectives, the first aspect of the present invention provides a training method for a medium- to long-term runoff prediction model, the training method comprising: Acquire sample data, which includes historical temperature sequences, historical precipitation sequences, and historical runoff sequences; The historical temperature series and historical precipitation series are decomposed into multi-scale sequences to obtain the decomposed historical temperature series and historical precipitation series respectively. The decomposed historical temperature and historical precipitation sequences are subjected to attention weighting to obtain a weighted aggregated sequence. The target medium- and long-term runoff prediction model is obtained by training a model using a pre-set deep learning model, historical runoff sequences, and weighted aggregate sequences.

[0012] In one feasible implementation, the deep learning model includes an LSTM-based Seq2Seq model, which comprises an encoder and a decoder. The encoder includes multiple layers of sequentially connected first LSTM units, and the decoder includes multiple layers of sequentially connected second LSTM units. The training of the model for medium- and long-term runoff prediction using a pre-defined deep learning model, historical runoff sequences, and weighted aggregated sequences to obtain the target medium- and long-term runoff prediction model includes: The aggregated sequence is used as the input sequence and input to the encoder. The first LSTM unit of each layer processes the data of each time step in the input sequence to extract features and obtain the context vector of the input sequence. The context vector is used as the initial input of the decoder. The second LSTM unit of each layer processes the data of each time step in the context vector in turn to perform medium- and long-term runoff prediction and obtain the medium- and long-term runoff prediction results. Determine the loss value between the medium- and long-term runoff forecast results and the historical runoff sequence; If the loss value is greater than the preset loss threshold, it is determined that the LSTM-based Seq2Seq model has not converged. The model parameters of the LSTM-based Seq2Seq model are adjusted based on the loss value, and the process of taking the aggregated sequence as the input sequence, inputting it into the encoder, and using the first LSTM unit of each layer to process the data of each time step in the input sequence in turn to extract features and obtain the context vector of the input sequence is returned. If the loss value is less than or equal to a preset loss threshold, the LSTM-based Seq2Seq model is determined to have converged, and the converged LSTM-based Seq2Seq model is used as the target medium- and long-term runoff prediction model.

[0013] In one feasible implementation, the step of performing multi-scale decomposition on the historical temperature sequence and the historical precipitation sequence to obtain the decomposed historical temperature sequence and historical precipitation sequence includes: The historical temperature sequence and historical precipitation sequence are decomposed into multiple scales using a preset maximum overlap discrete wavelet transform algorithm to obtain the scale coefficients and wavelet coefficients at each decomposition level. The signal is restored by using the scaling coefficients and wavelet coefficients at each decomposition level, resulting in the decomposed historical temperature and precipitation sequences.

[0014] In one feasible implementation, the step of using a preset maximum overlap discrete wavelet transform algorithm to perform multi-scale decomposition on the historical temperature sequence and the historical precipitation sequence to obtain the scale coefficients and wavelet coefficients at each decomposition level includes: Determine the preset target decomposition level; When the current decomposition level is 1, the historical temperature sequence and historical precipitation sequence are decomposed using the maximum overlap discrete wavelet transform algorithm to obtain the scale coefficients and wavelet coefficients of the first level of the historical temperature sequence and historical precipitation sequence respectively. When the current decomposition level is j, the maximum overlap discrete wavelet transform algorithm is used to decompose the scale coefficients of the (j-1)th level of the historical temperature sequence and the historical precipitation sequence, respectively, to obtain the scale coefficients and wavelet coefficients of the jth level of the historical temperature sequence and the historical precipitation sequence; where the value of j is in the range of 2≤j≤the target decomposition level, and j is a positive integer; The process of using the scaling coefficients and wavelet coefficients at each decomposition level to reconstruct the signal and obtain the decomposed historical temperature and precipitation sequences includes: By utilizing the wavelet coefficients of each layer of the historical temperature sequence and the historical precipitation sequence, as well as the scale coefficient of the j-th layer, the decomposed historical temperature sequence and historical precipitation sequence are obtained respectively.

[0015] In one feasible implementation, the attention-weighted processing of the decomposed historical temperature sequence and historical precipitation sequence to obtain a weighted aggregated sequence includes: Based on the decomposed historical temperature and precipitation sequences, an input feature sequence is constructed. The input feature sequence includes input features at each historical moment, including temperature features and precipitation features. Determine the query vector of the input features at the current historical moment, and the key vector and value vector of the input features at moments prior to the current historical moment; Using the query vector, the key vector, and a preset weighting algorithm, the attention weights of the input features at the current historical moment are determined; The input features at the current historical moment are weighted by the attention weights and the value vectors to obtain the weighted result of the input features at the current historical moment. The weighted aggregate sequence includes the weighted results of the input features at each historical moment.

[0016] To achieve the above objectives, a second aspect of the present invention provides a method for using a medium- to long-term runoff prediction model, the method comprising: Obtain the current temperature sequence and the current precipitation sequence; The current temperature sequence and the current precipitation sequence are decomposed into multiple scales to obtain the decomposed current temperature sequence and current precipitation sequence. The decomposed current temperature sequence and current precipitation sequence are subjected to attention weighting to obtain the weighted current aggregated sequence; Medium- and long-term runoff prediction is performed using the weighted current aggregation sequence and the target medium- and long-term runoff prediction model to obtain the target medium- and long-term runoff prediction results. The target medium- and long-term runoff prediction model is trained by the training method described in the first aspect and any feasible implementation.

[0017] To achieve the above objectives, a third aspect of the present invention provides a training apparatus for a medium- to long-term runoff prediction model, the apparatus comprising: Sample acquisition module: used to acquire sample data, including historical temperature series, historical precipitation series and historical runoff series; The first decomposition module is used to perform multi-scale decomposition on the historical temperature sequence and the historical precipitation sequence respectively, to obtain the decomposed historical temperature sequence and historical precipitation sequence. First attention module: used to perform attention weighting processing on the decomposed historical temperature sequence and historical precipitation sequence to obtain a weighted aggregated sequence; Model training module: Used to train a model for medium- and long-term runoff prediction using a preset deep learning model, historical runoff sequences, and weighted aggregate sequences, to obtain the target medium- and long-term runoff prediction model.

[0018] To achieve the above objectives, a fourth aspect of the present invention provides an apparatus for using a medium- to long-term runoff prediction model, the apparatus comprising: Data acquisition module: used to acquire the current temperature sequence and the current precipitation sequence; The second decomposition module is used to perform multi-scale decomposition on the current temperature sequence and the current precipitation sequence respectively, to obtain the decomposed current temperature sequence and the current precipitation sequence; The second attention module is used to perform attention weighting processing on the decomposed current temperature sequence and current precipitation sequence to obtain the weighted current aggregated sequence. Runoff prediction module: used to perform medium- and long-term runoff prediction using the weighted current aggregated sequence and the target medium- and long-term runoff prediction model, and to obtain the target medium- and long-term runoff prediction result. The target medium- and long-term runoff prediction model is trained by the training method described in any one of claims 1-5.

[0019] To achieve the above objectives, a fifth aspect of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps shown in the first aspect, the second aspect, and any feasible implementation.

[0020] To achieve the above objectives, a sixth aspect of the present invention provides a computer device including a memory and a processor, the memory storing a computer program, which, when executed by the processor, causes the processor to perform the steps shown in the first aspect, the second aspect, and any feasible implementation.

[0021] The embodiments of the present invention have the following beneficial effects: This invention provides a training method for a medium- to long-term runoff prediction model. The method includes: acquiring sample data, including historical temperature sequences, historical precipitation sequences, and historical runoff sequences; performing multi-scale decomposition on the historical temperature sequences and historical precipitation sequences respectively to obtain decomposed historical temperature sequences and historical precipitation sequences; performing attention weighting processing on the decomposed historical temperature sequences and historical precipitation sequences to obtain weighted aggregate sequences; and training a medium- to long-term runoff prediction model using a pre-set deep learning model, historical runoff sequences, and weighted aggregate sequences to obtain a target medium- to long-term runoff prediction model. By employing the above method, combining the advantages of multimodal recognition and deep learning, and through multi-scale decomposition, attention weighting, and deep learning model training for medium- to long-term runoff prediction, a target medium- to long-term runoff prediction model is finally obtained. This allows for the effective capture of multi-scale features and long-term dependencies in runoff data when predicting future medium- to long-term runoff, thereby improving forecast accuracy. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] in: Figure 1 This is a flowchart of a training method for a medium- to long-term runoff prediction model in an embodiment of the present invention; Figure 2 This is a schematic diagram of a Seq2Seq model structure based on LSTM in an embodiment of the present invention; Figure 3 This is a schematic diagram of an LSTM model structure in an embodiment of the present invention; Figure 4 This is a flowchart illustrating a method for using a medium- to long-term runoff prediction model in an embodiment of the present invention. Figure 5 This is a MODWT multiscale decomposition diagram of precipitation and temperature in an embodiment of the present invention; Figure 6 This is a scatter plot of medium- to long-term runoff prediction in an embodiment of the present invention; Figure 7 This is a structural block diagram of a training device for a medium- to long-term runoff prediction model in an embodiment of the present invention. Figure 8 This is a structural block diagram of a device for using a medium- to long-term runoff prediction model according to an embodiment of the present invention; Figure 9 This is a structural block diagram of a computer device in an embodiment of the present invention. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.

[0025] Please see Figure 1 , Figure 1 This is a flowchart illustrating a training method for a medium- to long-term runoff prediction model in an embodiment of the present invention. This method can be applied to either a terminal or a server. The terminal can be a desktop terminal or a mobile terminal; a mobile terminal can be at least one of a mobile phone, tablet computer, or laptop computer. The server can be a standalone server or a server cluster composed of multiple servers. This embodiment uses a terminal application as an example. Figure 1 The method shown includes the following steps: 101. Obtain sample data, which includes historical temperature sequences, historical precipitation sequences, and historical runoff sequences; It should be noted that in order to train the medium- and long-term runoff prediction model, samples need to be collected in advance. The training method of this application only needs to collect historical temperature series, historical precipitation series, and historical runoff series. Future runoff is predicted by temperature and precipitation. The historical temperature series is used to reflect historical temperature conditions and includes historical temperature data at least at each historical moment. The historical precipitation series is used to reflect historical precipitation conditions and includes historical precipitation data at least at each historical moment. The aforementioned historical data series can be collected for the city to be predicted, or for cities with similar climate environments, collecting historical data from multiple cities with similar climates. There is no limitation on this.

[0026] 102. Perform multi-scale decomposition on the historical temperature series and historical precipitation series respectively to obtain the decomposed historical temperature series and historical precipitation series; Furthermore, in order to better capture the multi-scale characteristics of the data, this application performs multi-scale decomposition on the collected historical sequences, specifically on the historical temperature sequences and historical precipitation sequences, to obtain the decomposed historical temperature sequences and historical precipitation sequences.

[0027] To better capture the periodicity, trend, and randomness of the data, this application employs Maximum Overlap Discrete Wavelet Transform (MODWT) for multi-scale decomposition. MODWT is a multi-scale decomposition method suitable for non-stationary signal analysis. MODWT can extract modal features at different time scales, thus better capturing the periodicity, trend, and randomness of the data. Using the MODWT method, multi-scale decomposition of daily precipitation and temperature is performed, defining a time series... X t MODWT decomposes the wavelet coefficients into scaling coefficients V and wavelet coefficients W through recursive convolution. Indicates the first High-frequency information at the j-th level (which can reflect short-term fluctuations); scaling factor This indicates low-frequency information (which can reflect long-term trends).

[0028] In one feasible implementation, step 102 includes steps A01 to A02: A01. Using a preset maximum overlap discrete wavelet transform algorithm, respectively, the historical temperature sequence is processed... X t and historical precipitation sequences X t Perform multi-scale decomposition to obtain the scaling coefficients V and wavelet coefficients W at each decomposition level; A02. The signal is restored using the scaling coefficient V and wavelet coefficient W at each decomposition level to obtain the decomposed historical temperature sequence and historical precipitation sequence.

[0029] Furthermore, step A01 includes steps B01 to B03: B01. Determine the preset target decomposition level; When the current decomposition level is 1, B02 uses the maximum overlap discrete wavelet transform algorithm to decompose the historical temperature sequence and the historical precipitation sequence respectively, and obtains the scale coefficient V and wavelet coefficient W of the first level of the historical temperature sequence and the historical precipitation sequence respectively. When the current decomposition level is j, B03 uses the maximum overlap discrete wavelet transform algorithm to decompose the scale coefficient V of the (j-1)th level of the historical temperature sequence and the historical precipitation sequence, respectively, to obtain the scale coefficient and wavelet coefficient of the jth level of the historical temperature sequence and the historical precipitation sequence; where the value of j is in the range of 2≤j≤the target decomposition level, and j is a positive integer; First, the desired number of decomposition levels needs to be determined. This application uses a target decomposition level of 4 as an example. Further, when the decomposition level is 1, the original input historical sequence is used as the decomposition object. When the decomposition level is greater than 1, the scaling coefficients obtained from the previous level are used as the decomposition object. This process is repeated layer by layer. When the current decomposition level equals the target decomposition level, the multi-scale decomposition result of the historical sequence is obtained. This multi-scale decomposition result includes at least the scaling coefficient V obtained from the last decomposition level and N wavelet coefficients W obtained from each decomposition level, where N equals the target decomposition level.

[0030] For example, when the current decomposition level is 1, the historical temperature sequence and historical precipitation sequence are decomposed using the maximum overlap discrete wavelet transform algorithm as follows: According to Mallat's algorithm, when the decomposition level is 1, the scaling factor of MODWT is... and wavelet coefficients The calculation method is as follows: ; ; In the formula, This represents the low-frequency component at time t after the first layer of decomposition. The value represents the high-frequency component at time t after the first level of decomposition; j is the decomposition level (time scale), which determines the size of the feature's time window. This is the low-pass filter for MODWT at decomposition level j; For MODWT at decomposition level j; Where N is the filter length; N is the length of the time series; This indicates the modulo operation.

[0031] When the current decomposition level is j, the scale coefficient V of the historical temperature sequence and the historical precipitation sequence at level j-1 is decomposed using the maximum overlap discrete wavelet transform algorithm as follows: The scaling factor of MODWT at decomposition level j. and wavelet coefficients The calculation method is as follows: ; ; In the formula, This represents the low-frequency component at time t after the j-th layer decomposition. This represents the high-frequency component at time t after the j-th layer decomposition.

[0032] The step of using the scaling coefficients and wavelet coefficients of each decomposition level to reconstruct the signal and obtain the decomposed historical temperature sequence and historical precipitation sequence includes: using the wavelet coefficients of each level of the historical temperature sequence and historical precipitation sequence and the scaling coefficient of the j-th level to obtain the decomposed historical temperature sequence and historical precipitation sequence respectively.

[0033] Finally, the signal is reconstructed using the multi-scale decomposition results. Specifically, the wavelet coefficients of each layer of the historical temperature and precipitation sequences are used. to ) and the scaling factor of the j-th layer ( The decomposed historical temperature and historical precipitation sequences were obtained respectively.

[0034] 103. The decomposed historical temperature sequence and historical precipitation sequence are subjected to attention weighting to obtain a weighted aggregate sequence; Furthermore, attention-weighted processing is applied to the decomposed historical temperature and precipitation sequences to obtain a weighted aggregated sequence. In one feasible implementation, step 103 includes steps C01 to C04: C01. Based on the decomposed historical temperature sequence and historical precipitation sequence, construct an input feature sequence, which includes input features at each historical moment, including temperature features and precipitation features; C02. Determine the query vector Q of the input features at the current historical moment, and the key vector K and value vector V of the input features at moments before the current historical moment; C03. Using the query vector, the key vector, and the preset weighting algorithm, determine the attention weight α of the input features at the current historical moment; C04. Perform weighted processing based on the attention weights and the value vector to obtain the weighted result X of the input features at the current historical moment. t ’ The weighted aggregation sequence includes the weighted results of the input features at each historical moment.

[0035] It should be noted that, since runoff is a complex nonlinear response driven by multiple factors, including multi-scale precipitation and temperature, the introduction of an attention mechanism allows the model to automatically select historical temperature and precipitation features that best match the current temperature and precipitation conditions, thereby improving prediction accuracy and extending the lead time. The core idea of ​​the attention mechanism is to compute a weighted context vector for each time step of the decoder. This vector is the weighted sum of all hidden states in the input sequence. The weights are determined by the attention score, which reflects the importance of each time step in the input sequence to the current output time step.

[0036] Attention mechanisms are used to automatically learn the similarity or relevance between inputs from different modalities. The model obtains weights by calculating the dot product between the query and the key, and then uses these weights to perform a weighted summation of the values, thereby achieving dynamic aggregation of information. We define similar modal queries, keys, and values ​​as follows: ; ; ; In the formula, Input features at time t The query vector, with input features including precipitation and temperature features; Input features at time t The key vector; Input features at time t The value vector; It is the input feature at the current time t (including precipitation and temperature multi-scale information obtained from MODWT decomposition); It is the input feature of historical time k before the current time t; , , This is a learnable parameter matrix. For historical temperature and precipitation sequences, the current time t is the current historical time being processed, and historical times are the times before the current time t.

[0037] The preset weighting algorithm uses scaled dot product attention to calculate the importance of historical data. ; in, Attention weights; The dimension of the key vector; This is an index of all historical time steps for normalized attention weights.

[0038] Finally, a weighted processing is performed based on the attention weights and the value vectors, including assigning different levels of importance to historical data according to modal similarity. This makes the model pay more attention to historical data that matches the current modality, thereby improving prediction ability. The attention-weighted historical information is as follows: ; In the formula, This is the weighted result of the input features at the current historical time t; Attention weights corresponding to the input features at the current historical time t; This is the value vector corresponding to the input features at the current historical time t.

[0039] 104. Using a pre-set deep learning model, historical runoff sequences, and weighted aggregated sequences, train a medium- and long-term runoff prediction model to obtain the target medium- and long-term runoff prediction model.

[0040] Finally, a medium- to long-term runoff prediction model is trained using a pre-defined deep learning model, historical runoff sequences, and weighted aggregated sequences to obtain the target medium- to long-term runoff prediction model. For example, the deep learning model can be an LSTM-based Seq2Seq model.

[0041] The Seq2Seq (Sequence-to-Sequence) model is a deep learning model used for processing sequence-to-sequence mappings. In medium- to long-term runoff simulations, the Seq2Seq model can use historical sequences as input to predict runoff sequences over a future period. A Seq2Seq model typically consists of two main parts: an encoder and a decoder. The encoder encodes the input sequence into a fixed-length context vector, while the decoder generates the output sequence (future runoff prediction) based on this context vector. The advantage of the Seq2Seq model lies in its ability to handle variable-length input and output sequences, and its ability to capture long-term dependencies in time series through LSTM (Long Short-Term Memory) network units. The model structure can be found in [reference needed]. Figure 2 and Figure 3 , Figure 2 This is a schematic diagram of a Seq2Seq model structure based on LSTM in an embodiment of the present invention; Figure 3 This is a schematic diagram of an LSTM model structure in an embodiment of the present invention.

[0042] in, Figure 2 This is an LSTM-based sequence-to-sequence (Seq2Seq) model structure for medium- to long-term runoff prediction. The left side is the encoder, which takes historical time series data as input. Each x(t) contains rainfall and temperature features after multi-scale decomposition. The encoder consists of multiple LSTM units that progressively extract temporal features, ultimately outputting a context vector (hidden state) as a compressed representation of the entire historical information. The right side is the decoder, also composed of LSTM units. It uses the encoder's final state as initial input and progressively generates runoff predictions for multiple future time steps. The output of each step serves as the input for the next step, until the output ends (marked by EOS). This entire structure can capture the temporal dependencies between input and output, enabling multi-step prediction of runoff over a future period.

[0043] in, Figure 3This is a diagram of the Long Short-Term Memory (LSTM) neural network model structure. LSTM is a specially designed recurrent neural network (RNN). LSTM has the ability to capture long-term dependencies in time series data. Its basic structure includes: memory units. Input gate Forgotten Gate and output gate These mechanisms work together to ensure that LSTM can efficiently learn and store long-term information, as shown in the following formula: ; In the formula Represents the input vector; It is the output information of the previous unit's state; and These represent the learnable weights and bias vectors of the neural network, respectively. and Indicates the activation function; This represents vector multiplication.

[0044] In one feasible implementation, the deep learning model includes an LSTM-based Seq2Seq model, which includes an encoder and a decoder. The encoder includes multiple layers of sequentially connected first LSTM units, and the decoder includes multiple layers of sequentially connected second LSTM units. Then, step 104 includes steps D01 to D05: D01. The aggregated sequence is used as the input sequence and input to the encoder. The first LSTM unit of each layer is used to process the data of each time step in the input sequence in turn to extract features and obtain the context vector of the input sequence. D02. Using the context vector as the initial input of the decoder, the second LSTM unit of each layer sequentially processes the data of each time step in the context vector to perform medium- and long-term runoff prediction, and obtains the medium- and long-term runoff prediction results. D03. Determine the loss value between the medium- and long-term runoff prediction results and the historical runoff sequence; D04. If the loss value is greater than the preset loss threshold, it is determined that the LSTM-based Seq2Seq model has not converged. The model parameters of the LSTM-based Seq2Seq model are adjusted based on the loss value, and the process of taking the aggregated sequence as the input sequence and inputting it into the encoder, using the first LSTM unit of each layer to process the data of each time step in the input sequence in turn to extract features and obtain the context vector of the input sequence is returned. D05. If the loss value is less than or equal to the preset loss threshold, then the LSTM-based Seq2Seq model is determined to be converged, and the converged LSTM-based Seq2Seq model is used as the target medium- and long-term runoff prediction model.

[0045] It should be noted that the encoder consists of multiple LSTM layers, with each LSTM unit processing the data at each time step of the input sequence sequentially. The final hidden state of the encoder is used as a context vector, capturing global information about the input sequence.

[0046] The decoder consists of multiple LSTM layers, but it uses the context vector generated by the encoder as its initial state and gradually generates the output sequence. The decoder generates one output at each time step and uses it as the input for the next time step until a complete output sequence is generated, which is then regarded as the medium- to long-term runoff prediction result.

[0047] Furthermore, convergence is determined by the loss value between the output sequence and the historical runoff sequence. If convergence is achieved, step D05 is executed to complete the training; otherwise, step D04 is executed to continue training.

[0048] This invention provides a training method for a medium- to long-term runoff prediction model. The method includes: acquiring sample data, including historical temperature sequences, historical precipitation sequences, and historical runoff sequences; performing multi-scale decomposition on the historical temperature sequences and historical precipitation sequences respectively to obtain decomposed historical temperature sequences and historical precipitation sequences; performing attention weighting processing on the decomposed historical temperature sequences and historical precipitation sequences to obtain weighted aggregate sequences; and training a medium- to long-term runoff prediction model using a pre-set deep learning model, historical runoff sequences, and weighted aggregate sequences to obtain a target medium- to long-term runoff prediction model. By employing the above method, combining the advantages of multimodal recognition and deep learning, and through multi-scale decomposition, attention weighting, and deep learning model training for medium- to long-term runoff prediction, a target medium- to long-term runoff prediction model is finally obtained. This allows for the effective capture of multi-scale features and long-term dependencies in runoff data when predicting future medium- to long-term runoff, thereby improving forecast accuracy.

[0049] Please see Figure 4 , Figure 4 This is a flowchart illustrating a method for using a medium- to long-term runoff prediction model according to an embodiment of the present invention. This method can be applied to either a terminal or a server. The terminal can be a desktop terminal or a mobile terminal; a mobile terminal can be at least one of a mobile phone, tablet computer, or laptop computer. The server can be a standalone server or a server cluster composed of multiple servers. This embodiment uses a terminal application as an example. Figure 4 The method shown includes the following steps: 401. Obtain the current temperature sequence and the current precipitation sequence; 402. Perform multi-scale decomposition on the current temperature sequence and the current precipitation sequence respectively to obtain the decomposed current temperature sequence and current precipitation sequence; 403. Perform attention-weighted processing on the decomposed current temperature sequence and current precipitation sequence to obtain the weighted current aggregated sequence; 404. Using the weighted current aggregated sequence and the target medium-to-long-term runoff prediction model, medium-to-long-term runoff prediction is performed to obtain the target medium-to-long-term runoff prediction results. The target medium-to-long-term runoff prediction model is obtained through... Figure 1 The training method described above was used to train the equipment.

[0050] Understandably, the trained target medium- and long-term runoff prediction model can predict future runoff based on the current temperature and precipitation sequence; by collecting the current temperature and precipitation sequence in real time to predict runoff, the target medium- and long-term runoff prediction results can be obtained.

[0051] It should be noted that, Figure 4 The content of each step in the usage method shown is the same as Figure 1 The steps in the training method shown are similar, and will not be repeated here to avoid repetition. For details, please refer to [reference needed]. Figure 1 The content of each step in the training method shown.

[0052] For example, see [link / reference] Figures 5 to 6 The study area of ​​this application is the Liyuan Watershed, located upstream of the Shigu section of the Jinsha River system, in the northwestern part of the Yunnan-Guizhou Plateau and the western part of the Sichuan Basin. It originates from the Tuotuo River in southwestern Qinghai Province, flowing through the Qinghai-Tibet Plateau and Sichuan Province before finally emptying into Yunnan Province. The Liyuan Watershed covers a total area of ​​approximately 214,000 square kilometers, with an elevation ranging from 1,674 meters to 6,293 meters, gradually decreasing in elevation from northwest to southeast, with a maximum elevation difference exceeding 4,500 meters. The climate of this watershed is complex and variable, belonging to a semi-arid climate zone, significantly influenced by the plateau monsoon and subtropical monsoon, with an average annual precipitation of 462 mm. The interannual variation in runoff depth is large, and its distribution throughout the year is uneven. Runoff is mainly supplied by rainfall, snowmelt, and glacial meltwater. The region is significantly affected by the plateau mountain climate, with the rainy season concentrated from May to October. The climate characteristics of the area are low temperature and low rainfall, with relatively more precipitation downstream. The Liyuan watershed was selected as the study area. The watershed has a distinct topographic relief, with the elevation gradually decreasing from north to south. The mountainous terrain features are complex, and the underlying physical conditions exhibit significant spatial heterogeneity. in, Figure 5This invention presents a MODWT multiscale decomposition map of precipitation and temperature in an embodiment of the invention. Daily average measured precipitation, temperature, and runoff sequences were collected from the Liyuan watershed. The precipitation and temperature sequences were then subjected to MODWT multiscale decomposition using the Daubechies 4 wavelet with a decomposition level of 4. The multiscale decomposition results are shown below. Figure 6 .

[0053] in, Figure 6 This is a scatter plot for medium- to long-term runoff prediction in an embodiment of the present invention. Attention weights are calculated between the MODWT multi-scale precipitation and temperature sequences and the measured runoff sequences, and then input into a seq2seq-LSTM model based on an attention mechanism for multi-step prediction. Medium- to long-term prediction can be achieved by controlling the hyperparameters. The prediction results are as follows: Figure 6 As shown.

[0054] It should be noted that, addressing the challenges of medium- and long-term runoff forecasting and the limitations of existing methods, this invention proposes a method for using a medium- and long-term runoff prediction model, essentially a power plant medium- and long-term runoff forecasting method based on multimodal recognition and attention mechanisms. This method first utilizes Maximum Overlap Discrete Wavelet Transform (MODWT) to decompose historical data into multiple scales, extracting modal features at different time scales. Then, the decomposed multi-scale data is input into a seq2seq-LSTM model based on an attention mechanism for multi-step prediction. By introducing modal similarity calculation and dynamically adjusting the attention weights, the model focuses more on historical data matching the current modality, thereby improving prediction accuracy and extending the lead time. This method combines the advantages of multimodal recognition and deep learning, effectively capturing the multi-scale features and long-term dependencies of runoff data, providing a novel solution for power plant medium- and long-term runoff forecasting.

[0055] This invention provides a method for using a medium- to long-term runoff prediction model. The method includes: acquiring the current temperature sequence and the current precipitation sequence; performing multi-scale decomposition on the current temperature sequence and the current precipitation sequence respectively to obtain the decomposed current temperature sequence and the current precipitation sequence; performing attention weighting processing on the decomposed current temperature sequence and the current precipitation sequence to obtain a weighted current aggregate sequence; and using the weighted current aggregate sequence and the target medium- to long-term runoff prediction model to predict the medium- to long-term runoff, thereby obtaining the target medium- to long-term runoff prediction result. The target medium- to long-term runoff prediction model is obtained through... Figure 1 The training method was used to obtain the target medium- and long-term runoff prediction results. By adopting the above approach and combining the advantages of multimodal recognition and deep learning, through multi-scale decomposition, attention weighting, and deep learning model for medium- and long-term runoff prediction, the multi-scale features and long-term dependencies of runoff data can be effectively captured in future medium- and long-term runoff predictions, thereby improving forecast accuracy.

[0056] Please see Figure 7 , Figure 7 This is a structural block diagram of a training device for a medium- to long-term runoff prediction model according to an embodiment of the present invention, as shown below. Figure 7 The training device includes: Sample acquisition module 801: used to acquire sample data, which includes historical temperature series, historical precipitation series and historical runoff series; First decomposition module 802: used to perform multi-scale decomposition on the historical temperature sequence and historical precipitation sequence respectively, to obtain the decomposed historical temperature sequence and historical precipitation sequence; First attention module 803: used to perform attention weighting processing on the decomposed historical temperature sequence and historical precipitation sequence to obtain a weighted aggregated sequence; Model training module 804: Used to train a model for medium- and long-term runoff prediction using a preset deep learning model, historical runoff sequences, and weighted aggregate sequences, to obtain the target medium- and long-term runoff prediction model.

[0057] It should be noted that, Figure 7 The contents of each module in the device shown are... Figure 1 The steps in the method shown are similar, and will not be repeated here to avoid repetition. Please refer to the previous sections for details. Figure 1 The content of each step in the method shown.

[0058] This invention provides a training device for a medium- to long-term runoff prediction model. The device includes: a sample acquisition module for acquiring sample data, including historical temperature sequences, historical precipitation sequences, and historical runoff sequences; a first decomposition module for performing multi-scale decomposition on the historical temperature sequences and historical precipitation sequences respectively, obtaining decomposed historical temperature sequences and historical precipitation sequences; a first attention module for performing attention-weighted processing on the decomposed historical temperature sequences and historical precipitation sequences, obtaining a weighted aggregated sequence; and a model training module for training a medium- to long-term runoff prediction model using a preset deep learning model, historical runoff sequences, and the weighted aggregated sequence, obtaining a target medium- to long-term runoff prediction model. By employing the above device, combining the advantages of multimodal recognition and deep learning, and through multi-scale decomposition, attention weighting, and deep learning model training for medium- to long-term runoff prediction, a target medium- to long-term runoff prediction model is finally obtained. This enables the effective capture of multi-scale features and long-term dependencies in runoff data when predicting future medium- to long-term runoff, improving forecast accuracy.

[0059] Please see Figure 8 , Figure 8 This is a structural block diagram of a device for using a medium- to long-term runoff prediction model according to an embodiment of the present invention, such as... Figure 8 The apparatus shown includes: Data acquisition module 901: used to acquire the current temperature sequence and the current precipitation sequence; The second decomposition module 902 is used to perform multi-scale decomposition on the current temperature sequence and the current precipitation sequence respectively to obtain the decomposed current temperature sequence and the current precipitation sequence; Second attention module 903: used to perform attention weighting processing on the decomposed current temperature sequence and current precipitation sequence to obtain the weighted current aggregated sequence; Runoff prediction module 904: Used to perform medium- and long-term runoff prediction using the weighted current aggregated sequence and the target medium- and long-term runoff prediction model, to obtain the target medium- and long-term runoff prediction result. The target medium- and long-term runoff prediction model is obtained through... Figure 1 The training method described above was used to train the equipment.

[0060] It should be noted that, Figure 8 The contents of each module in the device shown are... Figure 4 The steps in the method shown are similar, and will not be repeated here to avoid repetition. Please refer to the previous sections for details. Figure 4 The content of each step in the method shown.

[0061] This invention provides an apparatus for using a medium- to long-term runoff prediction model. The apparatus includes: a data acquisition module for acquiring current temperature and precipitation sequences; a second decomposition module for performing multi-scale decomposition on the current temperature and precipitation sequences to obtain decomposed current temperature and precipitation sequences; a second attention module for performing attention-weighted processing on the decomposed current temperature and precipitation sequences to obtain a weighted current aggregate sequence; and a runoff prediction module for using the weighted current aggregate sequence and a target medium- to long-term runoff prediction model to perform medium- to long-term runoff prediction, obtaining the target medium- to long-term runoff prediction result. The target medium- to long-term runoff prediction model is obtained through... Figure 1 The training method yields the results. Using the aforementioned device, combining the advantages of multimodal recognition and deep learning, through multi-scale decomposition, attention weighting, and deep learning model for medium- and long-term runoff prediction, the target medium- and long-term runoff prediction results are finally obtained. This enables the effective capture of multi-scale features and long-term dependencies of runoff data in future medium- and long-term runoff predictions, thereby improving forecast accuracy.

[0062] Figure 9 An internal structural diagram of a computer device in one embodiment is shown. This computer device can specifically be a terminal or a server. Figure 9As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program, which, when executed by the processor, causes the processor to perform the aforementioned methods. The internal memory may also store a computer program, which, when executed by the processor, causes the processor to perform the aforementioned methods. Those skilled in the art will understand that… Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0063] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform actions such as... Figure 1 or Figure 4 The steps of the method shown.

[0064] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the following actions: Figure 1 or Figure 4 The steps of the method shown.

[0065] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0066] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0067] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for training a medium and long term runoff prediction model, characterized in that, The training method comprises: obtaining sample data, the sample data comprising a historical temperature sequence, a historical precipitation sequence and a historical runoff sequence; respectively performing multi-scale decomposition on the historical temperature sequence and the historical precipitation sequence to obtain decomposed historical temperature sequence and historical precipitation sequence; performing attention weighting processing on the decomposed historical temperature sequence and the historical precipitation sequence to obtain a weighted aggregated sequence; using a preset deep learning model, a historical runoff sequence and the weighted aggregated sequence to perform model training for medium and long term runoff prediction, to obtain a target medium and long term runoff prediction model.

2. The training method of claim 1, wherein, The deep learning model comprises an LSTM-based Seq2Seq model, the LSTM-based Seq2Seq model comprises an encoder and a decoder, the encoder comprises a plurality of first LSTM units connected in sequence, and the decoder comprises a plurality of second LSTM units connected in sequence, and the using a preset deep learning model, a historical runoff sequence and the weighted aggregated sequence to perform model training for medium and long term runoff prediction, to obtain a target medium and long term runoff prediction model comprises: inputting the aggregated sequence as an input sequence into the encoder, using the first LSTM unit of each layer to sequentially process each time step data in the input sequence for feature extraction to obtain a context vector of the input sequence; using the context vector as an initial input of the decoder, using the second LSTM unit of each layer to sequentially process each time step data in the context vector for medium and long term runoff prediction to obtain a medium and long term runoff prediction result; determining a loss value between the medium and long term runoff prediction result and the historical runoff sequence; if the loss value is greater than a preset loss threshold, determining that the LSTM-based Seq2Seq model has not converged, adjusting model parameters of the LSTM-based Seq2Seq model based on the loss value, and returning to perform the inputting the aggregated sequence as an input sequence into the encoder, using the first LSTM unit of each layer to sequentially process each time step data in the input sequence for feature extraction to obtain a context vector of the input sequence step; if the loss value is less than or equal to the preset loss threshold, determining that the LSTM-based Seq2Seq model has converged, and taking the converged LSTM-based Seq2Seq model as the target medium and long term runoff prediction model.

3. The training method of claim 1, wherein, The respectively performing multi-scale decomposition on the historical temperature sequence and the historical precipitation sequence to obtain decomposed historical temperature sequence and historical precipitation sequence comprises: respectively performing multi-scale decomposition on the historical temperature sequence and the historical precipitation sequence using a preset maximum overlap discrete wavelet transform algorithm to obtain scale coefficients and wavelet coefficients under each decomposition layer; performing signal restoration using the scale coefficients and the wavelet coefficients under each decomposition layer to obtain the decomposed historical temperature sequence and the historical precipitation sequence.

4. The training method of claim 3, wherein, The preset maximum overlap discrete wavelet transform algorithm is used for multi-scale decomposition of the historical temperature sequence and the historical precipitation sequence respectively, to obtain scale coefficients and wavelet coefficients at each decomposition level, including: determining a preset target decomposition level; when the current decomposition level is 1, the maximum overlap discrete wavelet transform algorithm is used to decompose the historical temperature sequence and the historical precipitation sequence respectively, to obtain scale coefficients and wavelet coefficients of the first layer of the historical temperature sequence and the historical precipitation sequence respectively; when the current decomposition level is j, the maximum overlap discrete wavelet transform algorithm is used to decompose the scale coefficients of the j-1 layer of the historical temperature sequence and the historical precipitation sequence respectively, to obtain scale coefficients and wavelet coefficients of the j layer of the historical temperature sequence and the historical precipitation sequence respectively; wherein the value range of j is 2≤j≤the target decomposition level, and j is a positive integer; then the scale coefficients and wavelet coefficients at each decomposition level are used for signal restoration to obtain the decomposed historical temperature sequence and the decomposed historical precipitation sequence, including: the wavelet coefficients of each layer and the scale coefficients of the j layer of the historical temperature sequence and the historical precipitation sequence are used respectively to obtain the decomposed historical temperature sequence and the decomposed historical precipitation sequence.

5. The training method of claim 1, wherein, The decomposed historical temperature sequence and the decomposed historical precipitation sequence are subjected to attention weighting processing to obtain a weighted aggregated sequence, including: based on the decomposed historical temperature sequence and the decomposed historical precipitation sequence, an input feature sequence is constructed, the input feature sequence includes input features at each historical time, and the input features include temperature features and precipitation features; a query vector of the input features of the current historical time, and a key vector and a value vector of the input features of the time before the current historical time are determined; an attention weight of the input features of the current historical time is determined using the query vector, the key vector, and a preset weight algorithm; a weighted result of the input features of the current historical time is obtained according to the attention weight and the value vector, and the weighted aggregated sequence includes the weighted result of the input features of each historical time.

6. A method of using a medium-long term runoff prediction model, characterized by, The use method includes: obtaining a current temperature sequence and a current precipitation sequence; the current temperature sequence and the current precipitation sequence are subjected to multi-scale decomposition respectively to obtain a decomposed current temperature sequence and a decomposed current precipitation sequence; the decomposed current temperature sequence and the decomposed current precipitation sequence are subjected to attention weighting processing to obtain a weighted current aggregated sequence; a target medium and long-term runoff prediction result is obtained by using the weighted current aggregated sequence and a target medium and long-term runoff prediction model, and the target medium and long-term runoff prediction model is trained by the training method of any one of claims 1-5. 7.A device for training a medium and long term runoff prediction model, characterized in that, The device includes: a sample acquisition module for acquiring sample data, the sample data including a historical temperature sequence, a historical precipitation sequence, and a historical runoff sequence; a first decomposition module for multi-scale decomposition of the historical temperature sequence and the historical precipitation sequence respectively to obtain a decomposed historical temperature sequence and a decomposed historical precipitation sequence; The first attention module is configured to perform attention weighting on the decomposed historical temperature sequence and the historical precipitation sequence to obtain a weighted aggregated sequence. The model training module is configured to train a long-term runoff prediction model by using a preset deep learning model, a historical runoff sequence, and the weighted aggregated sequence, to obtain a target long-term runoff prediction model.

8. A use of a medium and long term runoff prediction model, characterized by, The device comprises: The data acquisition module is configured to acquire a current temperature sequence and a current precipitation sequence. The second decomposition module is configured to perform multi-scale decomposition on the current temperature sequence and the current precipitation sequence respectively to obtain a decomposed current temperature sequence and a decomposed current precipitation sequence. The second attention module is configured to perform attention weighting on the decomposed current temperature sequence and the decomposed current precipitation sequence to obtain a weighted current aggregated sequence. The runoff prediction module is configured to perform long-term runoff prediction by using the weighted current aggregated sequence and the target long-term runoff prediction model to obtain a target long-term runoff prediction result, wherein the target long-term runoff prediction model is obtained by the training method of any one of claims 1-5.

9. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to enable the processor to perform the steps of the training method of any one of claims 1-5 or the steps of the use method of claim 6. 10.A computer device, comprising a memory and a processor, and characterized in that, The memory stores a computer program, and the computer program is executed by the processor to enable the processor to perform the steps of the training method of any one of claims 1-5 or the steps of the use method of claim 6.