Nonlinear modeling of hydroturbine dynamic characteristics using LSTM neural network with feedback

Nonlinear modeling of the hydroturbine is one of the current research hot spots. The existing nonlinear hydroturbine model lacks “memory capability,” which means that the output of the model is not related to the historical input and output; that is, the model is a description of the static characteristics of the hydroturbine. To address this issue, based on actual operation data, this paper proposes long short‐term memory artificial neural network (LSTMNN) with output feedback to realize real‐time dynamic modeling of hydroturbine. Firstly, the torque characteristic sample data are calculated from the actual operation data, and the operation data of the hydropower unit are converted into the discharge characteristic sample data through hydroturbine test data. Then, by training LSTM neural networks with different feedback orders, the optimal order is got, and at the same time, the superiority of replacing time lag with the output feedback is verified. On this basis, a feedback‐based hydroturbine LSTMNN model is obtained. Finally, the proposed modeling method is compared with standard back‐propagation neural network with output feedback (F‐BPNN), through which the effectiveness and applicability are verified. The results show that: (a) By introducing output feedback, the accuracy of nonlinear hydroturbine model can be increased and the proposed modeling method is better than F‐BPNN; (b) the hydroturbine LSTMNN model can not only describe the static characteristics, but also reflect the real‐time dynamic characteristics; (c) taking the actual operation data of hydroturbine as the sample data source, the proposed modeling method can replace the traditional modeling method and effectively improve the numerical simulation accuracy.


| INTRODUCTION
In recent years, China's energy structure has been gradually adjusted, and the proportion of clean energy power generation such as wind power and photovoltaic has been increasing, so a pattern of parallel operation of multiple power sources, multi-energy complementary, and coordinated operation has gradually formed. 1 However, due to the randomness of clean energy power generation and other issues, large-scale clean energy access has brought huge challenges to safe and stable operation of power system. In the power system, the hydropower unit is undertaking tasks such as peak and frequency modulation and emergency backup. The access of clean energy puts forward higher requirements on the regulation and control quality of hydropower units. Therefore, it is extremely urgent to improve dynamic quality of hydropower unit regulation system. Simulation modeling is the basis for studying the optimal control of hydropower units, and it is very important to establish a high-precision model that can reflect the dynamic characteristics of hydropower unit regulation system.
Hydroturbine is the key part of hydroturbine regulation system. It contains extremely complex nonlinear and dynamic characteristics, 2 which is difficult to describe through the basic mathematical functions. At present, the mathematical model of hydroturbine can only be established through measured value of hydropower unit, model test data, or approximate analytical methods. 3 Commonly used hydroturbine models are divided into nonlinear and linear models. Nonlinear models mainly include hydroturbine models based on full-characteristic data, hydroturbine internal characteristic models, and simplified analytical nonlinear models. Linear models mainly include models based on model test data, models based on internal characteristic analysis method, and ideal hydroturbine model. 4 Hydroturbine nonlinear model is based on hydroturbine model test data, the basic idea to establish it is to linearly expand each operating point to obtain the corresponding transfer coefficients, and adjust the hydroturbine model parameters through looking up the Table, or obtain the discharge and torque characteristic data, and using artificial intelligence methods such as neural networks, 5 but the accuracy of discretization or interpolation calculation is limited, and the dynamic characteristics of turbine cannot be described under large fluctuations owning to lack of small-opening characteristic data. Hydroturbine model based on internal characteristics does not need to rely on model test data, but establishes the complex relationship between turbine structural parameters and working condition parameters through basic hydroturbine equations and energy conservation equations, which have been applied in the calculation of the transition process of hydropower units. 6,7 However, it is difficult to avoid the measurement error of the structural parameters on which the modeling depends, and it is often impossible to measure in time when the structural parameters change, which affects the accuracy and reliability of the model. The simplified analytical nonlinear hydroturbine model approximates the turbine as a valve, but considers the influence of hydraulic loss and no-load loss. 6 The ideal hydroturbine model is a lossless linear analytical model, which has been widely used in power system simulation, but the accuracy and scope of application of power system-transient stability analysis need further research. 6 In addition, some scholars have proposed other hydroturbine model, such as recursive linear hydroturbine model with both calculation speed and accuracy suitable for power system simulation, and nonlinear hydroturbine model that reflects the energy characteristics of the system. 6 For Francis turbine, the static characteristics represent the relationship between torque or flow and unit speed and guide vane opening in steady state, and the dynamic characteristics represent the variation characteristics of torque or discharge between different steady states. 3 That's to say, the existing hydroturbine model lacks "memory capability", 8,9 which means the output of the model has no ties with historical input and output, and it is essentially a description of the static characteristics of the hydroturbine and cannot reflect the dynamic characteristics. However, in fact, the requirements for the simulation accuracy of the dynamic characteristics of hydroturbine model in engineering applications are gradually increasing, and the original static model cannot meet the requirements. Therefore, there is an urgent need to find new methods to model the dynamic characteristics of hydroturbines.
Long short-term memory artificial neural network is developed on the basis of recurrent neural network (RNN). Compared with RNN, it adds a module for maintaining long-term memory, which effectively overcome the drawback that RNN is difficult to maintain long-term memory. Since the output of LSTMNN has a strong correlation with the historical input of the model, it is suitable for fitting prediction. LSTMNN is widely used for energy futures prices prediction, 10 water demand of pump prediction, 11 air quality prediction, 12 prediction classification, 8,13 and other aspects. The results show that the overall network prediction accuracy is high when the input data fluctuate gently, but lower when the input data fluctuate greatly. BiLSTM neural network is a variant of LSTMNN. It is essentially a combination of forward LSTM and backward LSTM, which has been applied to crime classification, 14 text segmentation, 15 bearing remaining life prediction, 16 and so on. Feng C 17 regards hydropower unit white noise at the current time as input signal, and speed at the historical and current time as the input and output data, respectively, and uses the BiLSTM neural network for the parameter identification of the pump turbine model under known structure and unknown parameters. The results show that: The BiLSTM model has good identification capabilities, but it also has the problem of large network prediction errors when the input data fluctuate greatly.
Considering the advantages of LSTMNN, this paper introduces it into the field of hydroturbine modeling. In order to solve the problem that the output of LSTMNN at current time does not take into account the historical output, this paper proposes a feedback-based LSTMNN (F-LSTMNN) hydroturbine modeling method. Based on test data of hydroturbine, a real-time and high-precision hydroturbine neural network model reflecting its dynamic characteristics is built. Furthermore, comparing with the commonly used back-propagation neural network with output feedback (F-BPNN), it shows that the proposed method can reflect dynamic characteristics of hydroturbine with high precision, which verifies the effectiveness of the proposed method. Therefore, this method provides foundation and guarantee for the research of optimal control of hydroturbine.

| BPNN principle analysis
BPNN includes input layer, hidden layer, and output layer. 8,9 The BPNN structure is shown in Figure 1. The working signal propagates forward along the "input layer → hidden layer → output layer." If the expected output cannot be obtained in the output layer, the error signal propagates back, and the network weight and bias value are continuously adjusted to approach the expected working signal output within a certain error range.

| Hydroturbine modeling based on F-BPNN
Combining the powerful nonlinear fitting ability of BPNN and considering the output feedback at the same time, it is introduced into hydropower unit modeling to construct hydroturbine discharge neural network Q 11 = f Q (n 11 , y, Q 11 (t − 1), …,Q 11 (t − M)) and torque neural network M 11 = f M (n 11 , y, M 11 (t − 1), …, M 11 (t − M)). The hydroturbine F-BPNN model is shown in Figure 2. The network input is the current unit speed n 11 (t), guide vane opening y(t) and the unit discharge Q 11 (t − 1),…,Q 11 (t − M) or unit torque M 11 (t − 1),…, M 11 (t − M) at the previous M moments, and the network output is current Q 11 (t) or M 11 (t).
Before network training, initial settings are required. The values of initial network weights and bias are randomly generated. The training data at the initial time need to be combined with Q 11 or M 11 at previous M moments. That is to say, the current input of hydroturbine neural network includes M historical outputs. Because the data need to be initialized combining with previous hydroturbine output, and hydroturbine output changes little in shorter sampling time, this article assumes that the hydroturbine output at the first M moment is the same as the first output. The number of training times and hidden layers is determined according to the loss function image. The learning rate is adaptively adjusted according to the error change.

| LSTMNN principle analysis
LSTM is a cyclic neural network in the field of deep learning. It contains two transfer states, the hidden state h t and the cell state c t , which reflect "short-term memory" and "long-term memory," respectively. The cell unit structure is shown in Figure 3. The output of LSTM network has a F I G U R E 1 BPNN structure. x 0 … x n represent input data, w 01 … w nm , w 1 …w m represent weight value, b 1 … b m+1 represent bias value, n 1 … n m represent variables of hidden layer output calculation function, n m+1 represents variables of output layer output calculation function, f 1 (n 1 )…f 1 (n m ) represent output of hidden layer, f 2 (n m+1 ) represents output of output layer, and NN out represents output of BPNN strong correlation with the network input at current time and the network input at historical time. The reason is that LSTM introduces the "gate" structure to control input and output of hidden state and cell state. [14][15][16] LSTMNN uses the forget gate and input gate to control the information in the cell state c: The forget gate determines the amount of the information retained from cell state c t−1 at time t − 1 to cell state c t at time t, and the input gate determines the quantity of information storage from the network input x t to the cell state c t at time t; the output gate controls the information output of the hidden layer output value h t from the cell state c t at time t. The output calculation of the forget gate is shown in Equation (1), the output calculation of the input gate is shown in Equations (2) and (3), the cell state update calculation is shown in Equation (4), and the update calculation of output gate is shown in Equations (5) and (6), and prediction calculation of output update at current time is shown in Equation (7).
where c′ t is the memory at the current time; c t is the cell state at time t; x t is the network input at time t, including the current unit speed and guide vane opening, and the output feedback of the turbine unit discharge or unit torque; h t is the state of network hidden layer at time t; h t−1 is the state of network hidden layer at time t − 1; f t , i t , and o t are the value of forget gate, input gate, and output gate, respectively, at time t; σ is the sigmoid activation function; W f , W i , W o , W c , and W y are the forget gate input, input gate input, output gate input, the current input cell state, and the weight matrix of the output gate output, respectively; b f , b i , b o , b c , and c y are the forget gate input, input gate input, output gate input, current input cell state, and output gate bias, respectively; y′ t is the network output at current moment, which is current output of turbine, that is to say unit discharge or unit torque.
After the LSTMNN model completes the forward propagation, it follows the back-propagation process; that is, the model is extended to the deep network in time, and iteratively updated using the BPTT algorithm and the chain rule until the weights and thresholds in the model get the optimal solution. (1)

| Hydroturbine modeling based on F-LSTMNN
Combining the advantages of LSTM network and taking into account the historical output and current input, it is introduced into the hydropower unit modeling. Since LSTMNN output has no direct correlation with the historical network output, in order to describe the dynamic characteristics of the hydroturbine as much as possible, the feedback of hydroturbine output is introduced to construct hydroturbine discharge neural network Q 11 = f Q (n 11 , y, Q 11 (t − 1), …,Q 11 (t − M)) and torque neural network M 11 = f M (n 11 , y, M 11 (t − 1), …, M 11 (t − M)), which are based on feedback. In this paper, the hydroturbine F-LSTMNN model is shown in Figure 4. The network input is the current unit speed n 11 (t), guide vane opening y(t) and the unit discharge Q 11 (t − 1),…,Q 11 (t − M) or unit torque M 11 (t − 1),…, M 11 (t − M) at the previous M moments, and the network output is current Q 11 (t) or M 11 (t).

| MODELING PROCESS OF HYDROTURBINE BASED ON F-LSTMNN
The hydroturbine F-LSTMNN modeling process includes the following: obtaining sample data, determining feedback order, and analyzing unnecessary of network lag.

| Sample data acquisition
XLD hydropower station is located on the Jinsha River at the junction of Sichuan Province and Yunnan Province of China. It is the main power station of China's "west to East power transmission" project. It mainly supplies power to the eastern and central regions of China, taking into account the power needs of Sichuan and Yunnan provinces. The total installed capacity of the power station is 13.86 million kW. There are 9 Francis turbine units on the left and right bank respectively, and the single unit capacity is 700 000 kW. The hydroturbine parameters of XLD hydropower station are shown in Table 1.
This paper constructs sample data through the XLD hydropower station No. 10 unit operating data and the synthetic characteristic curve of hydroturbine which contains test data. The sampling time of operation data is 0.01 seconds, and the data operation cycle is about 14 minutes. The characteristic torque data are calculated using the actual operating data of hydropower unit to form a sample of torque characteristic. The discharge characteristic data cannot be directly obtained, but through the synthetic characteristic curve of hydroturbine. The process of obtaining discharge characteristic data is as follows: use BP neural network to constructs the efficiency characteristic neural network η = η (n 11 , M 11 ), and then uses the actual operating data n 11 and M 11 as the input of the efficiency characteristic neural network model to obtain the corresponding efficiency η, and further calculates the discharge data to form a hydroturbine discharge characteristic sample data.

| Torque characteristic data acquisition
The actual hydropower unit operating data including water head, guide vane opening, and power are obtained from the monitoring system. Further, these data are calculated by Equations(8)- (11) to get sample data including the unit speed (n 11 ) and unit torque (M 11 ) for torque characteristic modeling. The sample data distribution is shown in Figure 5. The dynamic change in the torque sample data is shown in Figure 6. As can be seen from Figures 5  and 6, the torque sample data have a certain volatility.
where n 11 is the unit speed; n r is the rated speed, n r = 125 rpm; H is the water head; D 1 is the diameter of runner, D 1 = 6.223 m; P is the power; M t is the torque; ω is the angular velocity; and M 11 is the unit torque.

| Discharge characteristic data acquisition
The characteristic data are obtained through the synthetic characteristic curve of hydroturbine. This process includes the following: obtain the training sample data from the synthetic characteristic curve of hydroturbine, as shown in Table 2; train the BP neural network model to obtain the efficiency characteristic neural network model η = η(n 11 , M 11 ); use n 11 and M 11 calculated from the actual operating data as the input of the efficiency characteristic neural network model; calculate the corresponding efficiency (η); and calculate the unit discharge (Q 11 ) corresponding to the actual operating data from Equation (12); forming F-LSTMNN hydroturbine discharge characteristic sample data.
where γ = ρg, ρ is the density of water, g is the constant of gravitational acceleration; η is the hydroturbine efficiency; Q 11 is the unit discharge. The discharge characteristic data acquisition process is shown in Figure 7. The actual error of efficiency characteristic neural network is shown in Figure 8, from which it can be seen that the network error is very small. The obtained sample data of the hydroturbine discharge characteristics corresponding to the actual operating data are shown in Figure 9, and the dynamic change in the sample data is shown in Figure 10. It can be seen that the volatility of the unit discharge is consistent with the unit torque in Figure 10, and all due to volatility produced by water head.

| F-LSTMNN feedback order determination
In order to improve the accuracy of hydroturbine modeling, it is proposed that the input of hydroturbine model increases the feedback of previous M output, but if the amount of feedback data is too large, it takes a long time for the network to enter the real-time feedback stage. Therefore, it is necessary to determine a suitable M to  obtain hydroturbine model with reasonable parameters. This paper takes M as 0, 1,… 9 and builds F-LSTMNN torque and discharge characteristic model, and uses the root mean square error (RMSE) and correlation coefficient (R) as the judgment index. The calculation equation is as follows as Equations (13) and (14). Take different M to acquire corresponding RMSE and R as shown in Figures 11  and 12, it can be seen that: the F-LSTMNN model has higher accuracy, and the nonfeedback LSTMNN model F I G U R E 7 Chart for obtaining a sample data of hydroturbine discharge characteristics F I G U R E 8 Actual error of efficiency characteristic neural network modeling F I G U R E 9 Sample data of hydroturbine discharge characteristics. The blue point represents data F I G U R E 1 0 Changes in hydroturbine discharge characteristic sample data F I G U R E 1 1 F-LSTMNN hydroturbine torque characteristic modeling root mean square error and correlation coefficient. The blue square represents RMSE data, and the red circle represents R data has lower accuracy; take M as 5, the modeling accuracy of torque and discharge characteristics is relatively high. Therefore, 5 is the optimal feedback order of the F-LSTMNN hydroturbine torque and discharge model.
where d i and y i , respectively, represent the true value and predicted value of the sample data, and n is the quantity of samples.

| Unnecessary analysis of network time lag
The input of F-LSTMNN hydroturbine model increases previous M output feedback to improve the dynamic performance, but the input parameters need to be initialized at the initial moment. In order to avoid parameter initialization, considering adding time lag with an order of "N" to the model, the time lag order is the same as the feedback order, that is, M = N numerically. In order to determine the impact of adding time lag on the accuracy of hydroturbine model, take torque characteristic model as an example, and take M as 5 (the optimal feedback order) to build XLD Power Station No. 10 unit model based on time lag LSTM neural network (D-LSTMNN). The results show that RMSE is 0.0029 and R is 0.9998. Compared with F-LSTMNN, RMSE has increased, and R varies little. The comparison of modeling effect and actual error of hydroturbine torque characteristics based on D-LSTMNN and F-LSTMNN are shown in Figure 13. It can be seen that the use of time lag instead of feedback does not significantly increase the modeling accuracy and affects the real-time performance of the turbine control system, and requires more time for the network to enter high-precision prediction state. Therefore, the use of F-LSTMNN can reflect the input and output of hydroturbine in real time and accurately and is more suitable for dynamic modeling.

| TEST VERIFICATION
In order to verify the effectiveness of the F-LSTMNNbased hydroturbine dynamic modeling method proposed in this paper, using the actual operation monitoring data of XLD Power Station No. 10 unit as the test sample source, F I G U R E 1 2 F-LSTMNN hydroturbine discharge characteristic modeling root mean square error and correlation coefficient. The blue square represents RMSE data, and the red circle represents R data

LSTMNN hydroturbine model
The torque and discharge characteristic sample data are divided into training set (take 90%) and test set (take 10%), and take M as 5 (the optimal feedback order) to train F-LSTMNN hydroturbine model. After network training, RMSE is 0.0044 and 0.0031, and R is 0.9914 and 0.9902, respectively. During the training process, the root mean square and loss function error are shown in Figure 14.
It can be seen that there is no big fluctuation during the decline of the root mean square and loss function error, which can converge to a smaller value. The neural network modeling results and errors of the hydroturbine torque and discharge characteristics are shown in Figure 15. It can be seen: The unit torque and unit discharge forecast data are basically consistent with the actual data, and the error is small, and it can follow the trend of actual data in real time; the discharge characteristic neural network has a smaller prediction error by comparison with torque characteristic neural network; F-LSTMNN can realize real-time and high-precision prediction of the hydroturbine torque and discharge characteristics, which effectively solves the current difficult problem of hydroturbine dynamic modeling.

| Contrast with F-BPNN hydroturbine model
To test the effect of F-LSTMNN hydroturbine modeling, take 100% of the total samples for training and test samples, respectively, and use different M to establish F-LSTMNN and F-BPNN hydroturbine torque and discharge characteristic model. The RMSE and R of the model are shown in Figures 16 and 17, respectively. It can be seen that the modeling accuracy can be improved through designed feedback, and the accuracy is higher when M is 5 and 4, respectively.
In order to compare the dynamic modeling effects of F-LSTMNN and F-BPNN, F-BPNN hydroturbine model (M = 5 for torque characteristic, M = 4 for discharge characteristic) and F-LSTMNN hydroturbine model (M = 5 for torque characteristic, M = 5 for discharge characteristic) were established. The modeling results are shown in Figure 18, and the error is shown in Figure 19. It can be seen: F-LSTMNN hydroturbine torque and discharge characteristic model only have large prediction errors for the initial few data; F-LSTMNN hydroturbine model can quickly enter the real-time and high-precision prediction state and can better adapt to the variable operating conditions; F-BPNN hydroturbine model has less prediction accuracy than LSTMNN when the operating conditions change greatly. The reason is that the current output of the F-BPNN model has no correlation with the historical input, which affects its dynamic effects.

F I G U R E 1 4 LSTM characteristic value changes
F I G U R E 1 5 Neural network modeling results and errors of hydroturbine torque and discharge characteristics F I G U R E 1 6 Root mean square error and correlation coefficient of hydroturbine torque characteristic model based on F-BPNN. The blue square represents RMSE data, and the red circle represents R data F I G U R E 1 7 Root mean square error and correlation coefficient of hydroturbine discharge characteristics based on F-BPNN. The blue square represents RMSE data, and the red circle represents R data

| CONCLUSIONS
Taking the actual operating data of hydropower unit as the training sample, this paper implements nonlinear dynamic modeling of hydroturbine based on F-LSTMNN and compares it with F-BPNN modeling method, some conclusions are obtained as follows: 1. Adding the feedback of model output to model input of hydroturbine torque and discharge characteristic neural network can reduce the overall error of the nonlinear modeling. 2. Compared with F-BPNN, the proposed F-LSTMNN modeling method can reflect dynamic characteristics of hydropower unit in real time, which meets the requirement of variable operating conditions. Therefore, it is more suitable for hydroturbine modeling. 3. Using output feedback to replace the time lag, the proposed F-LSTMNN model can reflect the dynamic characteristics of hydroturbine in real time without affecting the model accuracy. 4. The F-LSTMNN model of hydroturbine constructed with actual operating data has high accuracy, which provides guidance for the research of hydroturbine dynamic modeling methods.

ACKNOWLEDGMENTS
The authors thank National Natural Science Foundation of China (Grant no. 51979204).
F I G U R E 1 8 Neural network modeling results of hydroturbine torque characteristics and discharge characteristics F I G U R E 1 9 Comparison of actual errors between hydroturbine torque and discharge characteristic model