Research on Simulation and State Prediction of Nuclear Power System Based on LSTM Neural Network

. The nuclear power plant systems are coupled with each other, and their operation conditions are changeable and complex. In the case of an operation fault in these systems, there will be a large number of alarm parameters, which can cause humans to be hurt in the accidents under great pressure. Therefore, it is necessary to predict the values of the key parameters of a device system. The prediction of the key parameters’ values can help operators determine the changing trends of system parameters in advance, which can eﬀectively improve system safety. In this paper, a deep learning long short-term memory (LSTM) neural network model is developed to predict the key parameters of a nuclear power plant. The proposed network is veriﬁed by simulations and compared with the traditional grey theory. The simulation and comparison results show that the proposed LSTM neural network is eﬀective and accurate in predicting the key parameters of the nuclear power plant.


Introduction
e existing control methods are based on the detectionresponse principle, so the safety control system makes the judgment on the system state and takes the corresponding action only after detecting abnormal situations [1,2]. is type of control method, based on the feedback of the nuclear power plant system that uses the data generated by the reactor, is slow and incapable of making real-time decisions. e traditional statistical methods cannot accurately predict the nuclear power plant state under abnormal conditions since this is a nonlinear process [3,4]. In recent years, the deep learning methods have been used to predict the operation state of various systems under different working conditions using the mining and analysis of massive historical data. ese methods can predict the changing trend of the system's operational parameters under different working conditions in real-time and, accordingly, upgrade the safety control of nuclear power plants from the response after occurrence to the prediction and early intervention. In this way, the safety margin of a nuclear power plant can be significantly improved, and the problem of inevitable abnormal conditions that the previous passive control methods face can be overcome. e change in key parameters of a nuclear power plant represents the operation state of the plant, that is why it plays an important role in the operation safety of the nuclear power plant and has been the subject of many operational and safety analyses of a nuclear power plant systems [5][6][7].
us, an accurate prediction of the changing trend of key parameters can help operators to discover abnormal parameters timely; thus, it is of great significance in the field of system control. In recent years, machine learning-based methods have been widely used in the image recognition field, speech recognition field, and other fields, and great progress has been achieved [8,9]. Wei et al. combined the principal component analysis with the least squares support vector machine method, predicting the power plant load, and improved the prediction speed and accuracy by reducing the size of the prediction model input [10]. Hui et al. used the grey theory-based prediction to control the regulator in order to achieve the optimal control parameters [11]. Peng et al. proposed to track the changing trend of the dissolved gas concentration in the oil using the combination of the empirical mode decomposition and long short-term memory (LSTM) [12]. Zhang et al. used the bidirectional LSTM model and dynamic particle swarm optimization (DPSO) algorithm to balance global and local search abilities by adaptively adjusting the learning factors. e prediction accuracy and convergence speed of the model are improved [13]. e strong memory ability of the bidirectional long short-term memory (BiLSTM) network that was proposed by Yang and Zhao can help accurately distinguish the true positive from the preliminary test results, thus greatly reducing the number of false alarms [14]. Kumar and Malarvizhi developed a prediction model combining the bidirectional LSTM and convolutional neural network (CNN), in which the bidirectional LSTM is used to store POS marked time data and CNN is employed to extract potential features. e accuracy of emotion analysis was improved by 98.6% [15].
In this paper, a deep learning long short-term memory (LSTM) neural network is proposed to predict the key parameters of the nuclear power plant. e LSTM model is improved by using BiLSTM-attention.
e experimental results show that this method has better effect on the processing of nuclear power plant fluctuation data. Finally, the correctness of the method is verified by the prediction of the key parameters of the AP1000.

Nuclear Power Plant Simulation System Model.
A nuclear power plant represents a complex system, and due to the immature data acquisition procedures and other irresistible reasons, the fault data of a nuclear power plant can be obtained very difficultly, so the amount of the fault data that can be collected is limited [16][17][18][19]. In addition, a small number of available fault data samples cause limitations on the data mining technology, which leads to inadequate data mining, which further reduces the prediction accuracy of a deep learning neural network model. In order to overcome the problem of a small amount of the nuclear power plant data, in this work, a cosine platform is used to build the primary-circuit system model of a nuclear power plant [20].
rough the simulation test of the developed model under the steady conditions and typical accident conditions, the operation characteristics of the proposed prediction model are analyzed qualitatively under different conditions. e obtained results can provide the necessary theoretical foundation and massive data support for further performance and accident analysis of nuclear power plants.
e RELAP5 software is used to build the thermal-hydraulic model of the main system of the project analyzer. e proposed model consists of hydraulic components, thermal components, a point reactor model, control card, trip card, and signal interaction interface. Due to the limited space, in the following, only the development of hydraulic components, thermal components, and interfaces will be introduced. e AP1000 is used as a research object, and the established simulation model of a nuclear power plant system is shown in Figure 1.

Simulation of Steady-State Operation of Nuclear Power
Plant. Under the condition of a full power steady-state operation, all operation control types are switched to the automatic state. e comparison between the predicted parameters and the parameters provided in the design handbook when the reactor system is operating at full power is provided in Table 1. rough the analysis of the comparison results, it can be concluded that the steady-state conditions can be simulated well.

Simulation of Nuclear Power Plant Transient Operation.
Under the condition of a linear increase in the load, the turbine power is increased from 70% FP to 100% FP at the speed of 5% FP/min. e change in the turbine flow with the load is presented in Figure 2, where it can be seen that the turbine flow increases linearly from 70% of the rated flow to 100% of the rated flow at the speed of 5%/min. e change in nuclear power with the load is shown in Figure 3. Under the action of the reactor power control system, the referenced average temperature after conversion increases gradually due to the gradual increase in the turbine load. e average measured temperature is about zero, so the average reference temperature is larger than the measured one.
e negative temperature deviation is obtained by subtracting the average measured temperature from the referenced one, while the negative power deviation is obtained by subtracting the turbine load from the nuclear power due to the increase in the turbine load. e negative temperature deviation overlaps the negative power deviation, and the deviation signal is generated through the rod speed and rod direction control module to generate the rod lifting signal and rod speed signal. en, the rod speed and rod lifting signals are transformed into the increase in the rod position of the M-Bar group and, after that, into the increase in the positive reactivity. e positive reactivity signal is sent to the thermal model via the database platform, and then the nuclear power starts to increase. e increased nuclear power is sent back to the control and protection model, reducing the deviation signal and reactivity and forming a closed-loop control. As can be seen in Figure 3, the nuclear power of the reactor increases slowly with the load of the steam turbine and finally stabilizes at 100%.
As the load of the steam turbine increases, the heat taken away by the secondary circuit increases. So, the primary circuit has an average downward trend at the initial stage, and then the average temperature rises with the increase in nuclear power. e changing trend is shown in Figure 4. e transient pressure curve of the pressurizer is shown in Figure 5. Based on the analysis of the reactor power control curve and average transient temperature, the average temperature change has a great impact on the pressurizer pressure. At the initial stage, with the decrease in the average temperature, the pressurizer pressure also decreases. en, when the average temperature increases due to the increase in nuclear power, the pressurizer pressure increases too. When the pressurizer reaches a certain value, the pressurizer pressure is mainly regulated by the pressurizer pressure control system. e pressurizer pressure control system mainly controls the heater and spray valve by comparing the measured pressure of the pressurizer with the set value of 15.5 MPa according to the pressure deviation signal through the PI and PID controllers. Due to the high pressure of the pressurizer, there is a positive pressure deviation after subtracting the pressure setting value from it, and this deviation is compensated by the PI controller. e positive compensation pressure difference is not enough to open the spray valve. However, as this difference increases slowly, the opening degree of the proportional electric heating decreases    gradually, while the information about the opening degree signal of the proportional heater is sent to the thermal model through the database platform. According to this information, the thermal model reduces the heating capacity of electric heating, which decreases the pressurizer pressure.
en, the information about the pressurizer pressure is sent back to the control protection model, forming a closed-loop control. As presented in Figure 5, the pressurizer pressure in the later period decreased slowly and finally stabilized at 15.5 MPa. e transient response curve of the water level of the pressurizer is shown in Figure 6. As presented in Figure 6, in the early stage, the transient response curve is similar to the pressurizer pressure curve, mainly due to the influence of the average temperature of the primary circuit, and in this stage, there is the first decline. In the later stage, the average temperature of the primary circuit and the self-control system increases. When the reference water level of the linear conversion of the average temperature of the primary circuit is higher than the measured water level of the pressurizer, a positive deviation signal is obtained by subtracting the measured water level from the reference water level after the action of the water level control system of the pressurizer.
e positive deviation signal generates the closing signal of the charging pump and the opening signal of the drain valve, and these two signals are sent through different limit modules signals to the thermal model. In the thermal model, the water level of the pressurizer is increased by regulating the charging and discharging flows, and the information about the increased water level is sent back to the control protection model to form a closed-loop control. As shown in Figure 6, the final pressurizer level control is stable at the reference level. e transient water level curve of the evaporator is shown in Figure 7, where it can be seen that under the action of the water level control system of the evaporator, the turbine load increases linearly from 70% FP to 100% FP, and the reference water level of the evaporator increases slowly after the linear transformation of the turbine load. By subtracting the reference water level of the evaporator from the measured water level of the evaporator, a positive water level difference is obtained. After the deviation signal passes through the PID controller, the opening degree of the main water supply valve increases and the opening signal of the valve is sent to the thermal model. Based on the received opening signal, the thermal model increases the main feedwater flow, and the water level of the evaporator also increases. After the increase, the water level of the evaporator returns to the control and protection model, thus forming a closed-loop control. As shown in Figure 7, the final evaporator water level is stable at the reference water level. Since the pressure of the evaporator is maintained in the normal range, by the action of the bypass control system, the bypass valve and the air release valve are closed, and the result is normal. Figure 7 shows that the side discharge is zero.
rough the analysis, it can be concluded that the established control and protection system can provide efficient basic control functions, and the analyzer model can complete the linear power-up condition well.

Prediction Data Selection and Preprocessing.
By using the safety analysis results of the nuclear power plant, the impact of each design basis accident on each operation parameter can be analyzed, and the main characteristic parameters of each accident can be summarized. Combined with reference to the selection of safety parameters of other nuclear power plant safety state supervision systems, the safety function of a nuclear power plant is determined, dividing into the following six aspects, which can directly reflect the reactor system. Following the principle of the effectiveness of these safety functions, the first-level safety key parameters are selected as follows: reactor nuclear power, reactor outlet temperature, reactor main coolant flow, pressurizer pressure, steam generator water level, containment temperature, containment pressure, and pressurizer water level. e relationship between key safety functions and monitoring parameters is shown in Table 2.
However, since the containment integrity is not considered in the simulator, for the time being, the six key parameters, namely, the reactor nuclear power (N), reactor outlet temperature (th outlet ), reactor main coolant flow (FCO), pressurizer pressure (P pressurizer ), steam generator water level (L steam generator ), and pressurizer water level (L pressurizer ) are predicted. e experimental data were the data generated by the simulator, as presented in the following section. e data are given in Table 3.
In the nuclear power plant system, the application and development of a digital I&C system, sensors, and other data acquisition equipment provide a large amount of high-speed real-time data. ese data are massive, so it is necessary to detect and mine the timing data of the plant system. e LOCA accident is one of the very important research subjects in the safety analysis of a nuclear power plant, and it is also one of the accidents with a high probability of occurrence in system equipment. Namely, when a LOCA accident occurs in the system, the first obvious reaction is a significant change in the pressurizer pressure. Besides, the pressurizer pressure value can reflect the safety state of the nuclear power plant system, which is one of several key parameters of a plant system. erefore, in this paper, the pressurizer pressure is chosen as a research object of key parameter prediction. e nuclear power plant simulator that is presented in the following section is used to generate the simulation pressurizer pressure value of the LOCA accident; the simulator collects one dataset every 0.25 s. In spite of the 30-minute nonintervention principle of a nuclear power plant, the goal is to predict and evaluate the state of the nuclear power plant system in 30 minutes. In the simulation of 24 minutes, 5760 data samples were generated and collected to be used in the analysis. Namely, nuclear power can produce a large amount of data at every moment. A system fault often happens suddenly. In the view of the timeliness of data mining, the data have analytical value only before and after the failure. In accordance with the continuous time-series data, the sliding window technology is used to select the limited data segments before and after the failure. Next, the time-series data generated by the simulator are divided, and the time t is taken as the time base point, and the data corresponding to the time interval of [T -250, t] seconds are used as the prediction sample to predict the data corresponding to the time interval of [T, t + 100]. In short, 250 data samples before the current time are used to predict the data in the next 100 s. In the actual system operation process, it can provide the operators with 100 s of nuclear power plant status warning. e schematic diagram of a part of the time-series data is shown in Figure 8. e safety margin of a nuclear power plant is increased to a certain extent.

Prediction of Key Parameters of Nuclear Power Plant Based on Grey eory.
e collected time-series data of the steam generator water are used to predict the parameters of a nuclear power plant based on the grey theory. In order to ensure the feasibility of the modeling method, it should be tested. According to equation (1), the order ratio of the sequence can be calculated as follows: If all the grade ratios are in the range of (e −2/n+1 , e 2/n+2 ), the series can be used as the data of GM (1, 1) model for the grey theory-based prediction.
As shown in Figures 9-12, the prediction accuracy of the data series with a lower slope after 200 s was high, but there was an obvious fluctuation before the time reached the value 200 s. e error between the predicted and actual data was relatively large. e decline in the predicted data was not as severe as that of the measured data. According to the grey theory principle, the prediction model first accumulated the original data to generate a new sequence before the prediction. In this process, the irregular changes would be regarded as interference, and the sharp changes would be smoothed during the accumulation process. erefore, though the predicted data reflected the trend of the target data, there were some errors. When the measured data were declining step-by-step, as shown in Figure 10, the predicted data fluctuated to a certain extent and showed certain inertia. Science and Technology of Nuclear Installations 5 rough the analysis, the system is too large in the calculation and then leads to the prediction data and the actual measurement data error.

Prediction of Key Parameters of Nuclear Power Plant Based on LSTM.
e LSTM was first proposed by Hochreiter and Schmidhuber [19]. e LSTM can effectively model the long-term dependence of data and thus avoid gradient disappearance or explosion. In fact, the LSTM was designed to solve long-term dependency problems. Compared with the traditional RNN, the unique structure of the LSTM is its ingenious design of the circulatory structure. Since the information in the network can be persistent, the LSTM is more suitable to deal with the sequence prediction. e LSTM uses two gates to control the content of unit state, the forgetting gate, which determines how much the unit state c t−1 at the previous time is reserved to the current time c t , and the input gate, which determines how much the input x t of the current time is saved to the unit state c t . e output gate is used by the LSTM to control how much the unit state c t outputs to the current output value h t of the LSTM. e loop structure of the LSTM is shown in Figure 13.
(1) Forget the Door f t . e activation function of the forgetting gate is a sigmoidal function, and its output is between 0 and 1. When the output is 0, no information is allowed to pass; when the output result is 1, all information is allowed to pass; lastly, when the output result is between (0, 1), part of the information is allowed to pass, which is expressed by the following: where σ () denotes the sigmoid function, W f denotes the weight matrix of a variable, h t−1 denotes the hidden layer output at T−1, x t denotes the input at time t, and b f represents the offset. Pressure boundary integrity Pressurizer pressure (P pressurizer ) and steam generator water level (L steam generator ) 5 Coolant capacity Pressurizer water level (L pressurizer ) 15.57858 −0.081111865 6.50308 −0.00162 · · ·· · · · · ·· · · · · ·· · · · · ·· · · · · ·· · · · · ·· · · · · ·· · · 1491 3.   Science and Technology of Nuclear Installations (2) Input Gate i t . e input gate decides which information will be retained in the memory unit. First, the updated information is determined by h t−1 , x t , and sigmoid functions. en, the tanh activation function is used to create a new vector z to determine the update value of the next state memory unit. Finally, the product of the last state value C t−1 of the memory unit and the output f t of the forgetting gate is used to determine how much old information is left. e update value of a cell C t is obtained from the sum of the retained old information f t · C t−1 and the updated new information i t · Z, as given by the following: (3) e output gate consists of two parts. First, the output information is determined by h t−1 , x t , and activation function (sigmoid function), and then tanh activation function is applied to the memory unit C t , and the output h t is obtained by multiplying with it. Since the memory unit C t already contains the retained old information f t · C t−1 and the updated new information i t · Z, the final h t is determined based on the output, retaining the old and updated information.
e main advantages of this method compared with the neural networks used in noise processing are high accuracy, strong parallel distributed processing ability, large distributed storage and learning ability, and high robustness and fault tolerance. Also, it provides a full approximation of complex nonlinear relationships and associative memory. However, this method has certain disadvantages, which are as follows: the neural network needs a large number of training samples, it is unable to observe the learning process, and the output results are difficult to understand, which all affect the credibility and acceptability of the prediction results. When the collected time-series data were used as the input of the LSTM and neural network, the prediction results shown in Figures 14-17 were obtained.
As presented in Figures 14-17, there was a relatively stable change in the time-series data and the grey theory-based prediction achieved relatively high accuracy. However, the error between the LSTM prediction data and actual measurement data was even smaller. Also, for data sequences with obvious fluctuations, the LSTM prediction fluctuation has a certain lag without fluctuation. us, the LSTM prediction model using the forgetting gate, input gate, and output gate has better robustness in the time-series data prediction.

Comparative Analysis of Prediction Accuracy.
In this section, the data predicted by the LSTM model were compared with the data generated by the nuclear power     plant simulation system [20]. e similarity of these two datasets and the residuals was calculated under different working conditions. e changing trend and difference between the predicted and actual data were analyzed. e validity of the proposed prediction model was verified from different perspectives. In order to evaluate the prediction accuracy of the proposed model, the predictions based on the grey theory and the LSTM method were compared.
Evaluation Index. e prediction accuracies of the models based on the grey theory and LSTM network were compared. e RMSE was used as the evaluation index, and it was calculated by equation (4) [21], where S denoted the dataset, i denoted the index of S, I denoted an input sequence, M i represented the observed data, N i represented the corresponding output data, and N i denoted the data generated by the prediction model. e evaluation criteria are used based on the related literature [22], and they are shown in Table 4.
By using equation (4), the RMSE values of the model based on the grey theory and the LSTM model were calculated, and they are presented in Table 5.   Science and Technology of Nuclear Installations As shown in Table 5, the error of the LSTM model was smaller than that of the grey theory-based model, so the data predicted by the LSTM model reflected the system state of the nuclear power plant better.

Prediction of Key Parameters of Nuclear Power Plant Based on BiLSTM-Attention.
It can be seen from the above that the prediction accuracy of ordinary LSTM for the fluctuation parameters of the nuclear power plant is low; although compared with the prediction results of grey theory, it has a certain improvement. However, there is a big error with the actual collected data. erefore, it is necessary to further improve the LSTM. rough literature research, the bidirectional long short-term memory (BiLSTM) neural network has achieved good prediction results in other fields. Compared with BiLSTM, LSTM can only predict the output of the next moment according to the timing information of the previous time. However, in some problems, the output of the current moment is not only related to the previous state but also to the previous state. It may have something to do with the state of the future. ere are two LSTM models in BiLSTM structure (Figure 18), one is forward operation with time and the other is reverse operation with time. e reverse implementation essentially reverses the input timing data and then input it into the reverse LSTM. In this way, BiLSTM can obtain the data feature information in both positive and negative directions at the current node. In this way, the BiLSTM intermediate layer stores two values: one is to participate in forward calculation before C pre and the other is to participate in reverse calculation after parameter C post . e final calculated value depends on C pre and C post .
In addition, attention mechanism is widely studied in neuroscience and computational neuroscience. Attention mechanism has been used in deep learning, speech recognition, translation, reasoning, and visual recognition. e target mechanism can highlight more important information by assigning different weights to the hidden layer unit of the neural network. e input of attention is the data H1, H2, . . .. . . Ht−1, Ht. e weight vector is calculated according to the input vector of the current layer. Its function is to capture the internal relations of the output data of the BiLSTM layer, so as to pay more attention to BiLSTM and screen out important information. e weight calculation of the attention layer is shown in the following formula: where ơ i is the attention weight of the historical hidden layer to the current input hidden layer, w and u are the weight      Figure 19, y i is the predicted output at the i moment, and w i is the weight matrix. It was calculated by the following equation: erefore, based on the BiLSTM prediction model, this paper constructs a key parameter prediction model based on BiLSTM-attention to study the key operating parameters of the nuclear power plant. In this paper, the BiLSTM-attention nuclear power plant prediction model is established. e model is used for experimental verification and research.
First of all, the target data are normalized; because after the data normalization, the optimization process of the optimal solution will obviously become smooth, and it is easier to correctly converge to the optimal solution. en, the normalized data are constructed by sliding window because the data set can be input into the constructed neural network.
en, the BiLSTM-attention model is used to predict the data, and the data of the first 200 seconds are used to predict the data of the next second. Finally, the error between the predicted value and the actual measured value is calculated. If the error is large, the model parameters are adjusted and the adjusted model is trained. If the error is small, the model training is completed.

Analysis of Prediction Results.
In this paper, the LSTM neural network program is developed by python, the LSTM prediction model with 128 hidden layers is established, and the initial key parameters are input into the LSTM prediction model, and the predicted values are calculated. e calculation results are shown in Figure 20. At the same time, the prediction results of grey theory are given for comparison.
It can be seen from the figure that the prediction model based on BiLSTM-attention has better predictability for the fluctuation data; especially when the target data show the fluctuation state, the prediction model can also generate the fluctuation trend, which is the effect that the grey theory and LSTM model cannot achieve. According to the error formula, the error calculation rate is 0.1345. Compared with grey theory and LSTM prediction model, the error is greatly reduced. erefore, it can be seen that the prediction model of BiLSTM-attention has better prediction effect.

Conclusion
e LSTM neural network has great advantages in processing time-series data. In this paper, the LSTM neural network method is used to study the prediction technology of nuclear power plant key parameters, and the LSTM model is improved. e target mechanism and BiLSTM are combined to establish the data prediction model of the nuclear power plant based on BiLSTM-attention deep learning. By analyzing a large number of process parameters of the nuclear power plant, the original time-domain signal data are input into the neural network for training to improve the prediction accuracy. Compared with the prediction data based on the traditional grey theory model, the results show that the LSTM model has higher accuracy in the prediction of nuclear power plant time sequence data. BiLSTM-attention has a better accuracy for the prediction of fluctuation time-series data, which has certain reference significance for the application of the intelligent algorithm in the nuclear power plant.
Authors are grateful to Chinese Nuclear Energy Development and Research Projects "Research on Fault Diagnosis Technology of Marine Nuclear Power System Based on Deep Learning Neural Network Artificial Intelligence" for providing the financial support for this study.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that they have no conflicts of interest.