Machine Learning-Based Fault Diagnosis for a PWR Nuclear Power Plant

In the nuclear power industry, safety and reliability are of the utmost importance. Sensors and actuators are integral components in such systems, and potential faults may adversely impact system performance. It is therefore imperative to design a fault detection and diagnosis (FDD) system that achieves the highest standards of safety. This paper presents a machine learning-based fault detection and diagnosis (FDD) technique for actuators and sensors in a pressurized water reactor (PWR). In the proposed FDD framework, faults are first detected using a shallow neural network. Second, fault diagnosis is performed using 15 different classifiers provided in the MATLAB Classification Learner toolbox, including support vector machine (SVM), K-nearest neighbor (KNN), and ensemble. Several classifiers were found to provide superior classification performance, including medium KNN, cubic KNN, cosine KNN, weighted KNN, fine Gaussian SVM, quadratic SVM, medium Gaussian SVM, coarse Gaussian, bagged trees, and subspace KNN. The accuracy of the FDD approach was demonstrated using a set of simulation results.


I. INTRODUCTION
In recent years, increased awareness of global climate change has led to a renewed interest in nuclear energy. Nearly 10% of the world's electricity comes from nuclear power, and this number is set to increase as more power reactors are being constructed [1]. Nuclear power plants (NPPs) are complex systems with an enormous number of sensors and actuators. As actuators and sensors play a vital role in NPPs, any degradation or damage to them could adversely impact the power plant's performance and seriously affect its reliability and safety. Therefore, it is crucial to develop effective fault detection and diagnosis techniques for actuators and sensors in NPPs to prevent accidents, which will, in turn, guarantee safety and reliability of the NPPs.
Fault diagnosis methods are normally classified into model-, signal-or data-driven-based approaches. Modelbased FDD relies on a well-established model that represents The associate editor coordinating the review of this manuscript and approving it for publication was Essam A. Rashed . the normal behavior of practical processes. Fault diagnosis can be performed by comparing the model's output with the real-time process output [2], [3]. Signal-based FDD is based on an analysis of the output signal. Faults in the process are visible in either or both the frequency and time domains [4], [5]. An approach based on data-driven analysis relies on implicit knowledge derived from historic plant data, which can be obtained either by intelligent training or machine learning [6], [7].
Machine learning techniques play an important role in data-driven fault-diagnosis methods. Principal component analysis (PCA) models were employed to detect and diagnose sensor faults in the pressurizer of a pressurized water reactor (PWR) [8]. Li et al. [9] proposed an improved PCA-based method by combining a conventional PCA algorithm with a false-alarm reduction method, which was able to successfully detect and isolate sensor faults even when a minor failure occurred. In [10], PCA and Fisher discriminant analysis (FCA) were used to diagnose two types of faults in the actuator of a research reactor: the VOLUME 10, 2022 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ control rod withdrawal fault and the external reactivity insertion fault. Artificial neural networks (ANNs) have also been used for system identification and FDD in NPPs because they provide outstanding performance in estimating nonlinear systems [11], [12], [13], [14], [15]. An ANN-based FDD method using a K-nearest neighbor (KNN) for the sensor and actuator FDD of an NPP was proposed in [15]. Shallow neural networks were used to detect the faults, and a KNN algorithm was employed to classify the faults. They demonstrated the efficiency of their proposed FDD technique in terms of the detection and its classification accuracy.
Most of the methods discussed above focus on either sensor or actuator faults, but not on both. Specifically, the literature refers more to sensor faults than actuator faults [8], [9], [11], [12]. To the best of the authors' knowledge, only a few FDD approaches can detect and isolate faults in sensors and actuators in NPPs. The FDD approach proposed in [15] can detect and diagnose the presence of sensor and actuator faults; however, faults only concentrate on the reactor subsystem.
As an extension of [15], this study evaluates actuator faults and sensor faults throughout the entire PWR NPP using a practical machine learning-based approach. The proposed FDD approach was tested on faults that affect the sensors and actuators of the reactor core, steam generator, pressurizer pressure and level, and turbine-speed system. The main contributions of this paper are as follows: • A machine-learning-based FDD is proposed to address sensor's and actuator's faults of an entire PWR.
• The FDD method is used to diagnose failures in the reactor core, steam generators, pressurizer pressure and level systems, and turbine-speed system.
• An evaluation and comparison of SVM, KNN, and ensemble classifiers is conducted. The remainder of this paper is organized as follows: Section II provides a description of the PWR process. Section III discusses a fault-detection approch using neural networks. The fault-diagnosis approach is explained in Section IV, and Section V describes the simulation results of the proposed technique. The final section of this paper presents the conclusions.

II. PRESSURIZED WATER REACTOR
A classic PWR plant includes two main loops: primary and secondary loops. The primary loop comprises the reactor core, pressurizer, steam generator (SG), and reactor coolant pump. The reactor core can be described using a point kinetics model. The actuator, also called the control-rod system, is located inside the core. The basic purpose is to control the power of the core by adjusting the number of neutrons in it. The pressurizer is represented by the pressure and level equations. In the primary loop, the pressurizer maintains pressure such that boiling does not occur. Heat is transferred from the reactor core to the SG, where steam is produced and supplied to the secondary system. The turbine, moisture separators, and steam reheaters comprise the secondary loop. A brief summary of the reactor power core model is presented here for brevity. For a detailed and comprehensive description of the NPP mathematical model, sensors, and actuators, the reader is kindly referred to [16]. A summary of the essential inputs and outputs of the plant is presented in Table 1.

A. REACTOR CORE MODEL
The reactor model can be described using a point kinetics equation with six groups of delayed neutron precursors coupled with thermal hydraulics. The reactor core model is represented as follows [16]: In the above equations, P n is the normalized neutronic power; C in is the normalized delayed neutron precursor's concentration; β i and λ i are the fraction of delayed neutrons and decay constant, respectively; is the prompt neutron lifetime; ρ t and ρ rd represent the total reactivity and the reactivity due to the control rod, respectively; and T f , T c1 , and T c2 are the temperatures at fuel, coolant node 1 and node 2, respectively. H f and H c are constant values; τ c , and τ r represent time constants; α f and α c denote the temperature coefficients of reactivity due to fuel and coolant, respectively; G and v rd represent the reactivity worth and the rod speed, respectively.

B. TYPES OF FAULTS
This study considers bias and drift faults in sensors, and offset and saturation faults in actuators in five different loops of a PWR plant. In total, there are 20 faults, as listed in Table 2. A description of the faults is provided below.

1) BIAS FAULT
A fault of this type corresponds to a constant offset in the sensor's output, which could be due to incorrect calibration or physical changes in the sensors [17]. In this study, a bias fault was added to the reactor power, pressurizer level, pressurizer pressure, steam pressure and turbine speed sensors. The bias fault is mathematically modeled as follows: where s(t) denotes the output of the sensor, s * is the ideal measurement of the sensor, ζ is the measurement noise, and b is the bias added to the signal at a certain time.

2) DRIFT FAULT
This consists of an offset that changes over time. Drift faults are considered to be one of the most common faults in sensors. A number of factors contribute to this, including the corrosion of sensors over time and physical damage caused by extreme environmental conditions [18]. In the same way as the bias fault, the drift fault was injected into the reactor power, pressurizer level, pressurizer pressure, steam pressure and turbine speed sensors at a certain point in time. The drift fault can be mathematically represented as follows: where a 0 is a constant, a 1 denotes the scaling parameter and β is the decay rate.

3) ACTUATOR SATURATION FAULT
occurs when the actuator exceeds a set saturation value [19]. In this study, saturation was applied to the output of the control rod system, turbine governor valve, pressurizer heater, and pressurizer level actuator. Owing to the physical limitations of the actuator, its output can be described as follows: where Z max and Z min denote the maximum and the minimum value of the actuator, respectively. Z c denotes the required actuator output without taking actuator saturation into account.

4) ACTUATOR OFFSET FAULT
This corresponds to an offset added to the different actuator outputs at a certain time. Often, this failure occurs because of manufacturing defects or design flaws [20]. Similar to the actuator saturation fault, the actuator offset was injected into the control rod system, turbine governor valve, pressurizer heater, and pressurizer-level actuator outputs. The actuator offset fault can be modeled as follows: where z * represents the actuator output without considering the faults and ω is the offset injected at a certain time.

III. FAULT DETECTION BASED ON NEURAL NETWORKS
This section examines the use of neural networks for fault detection in PWR. First, a brief description of the neural network structure, specifically shallow neural networks, is provided. Following this, the fault-detection approach based on neural network is formulated.

A. NEURAL NETWORK ARCHITECTURE
This study uses feedforward networks consisting of three layers, as illustrated in Fig. 1 [15]. The first layer (input VOLUME 10, 2022  layer) represents the network interface with external inputs. The second layer is a hidden layer, where shallow neural networks typically have one hidden layer. Finally, the output layer generates estimations. The hidden layer h(h 1 , . . . , h N ), and the output layer y(y 1 , . . . , y N ) can be represented using the following equations: where x represents the input vector, w denotes the weight matrix (for instance, w xh is the input-to-hidden layer weight matrix), b represents the vector bias (for instance, b h represents the hidden bias vector, f 1 (.) denotes a sigmoid activation function while f 2 (.) denotes a linear activation function.

B. FAULT DETECTION METHODOLOGY
The previously described neural network is employed to detect the presence of faults in a PWR plant. The faultdetection approach consists of one neural network for each of the five loops of the plant. To accomplish this, each neural network is trained to learn one of the five input-output dynamics of the PWR plant. Each trained neural network is then used as a reference model to compare the output of the PWR plant (corresponding to a possibly faulty system) with the output of the neural network representing the nonfaulty system, resulting in residual signals. A schematic of the neural-network-based fault-detection approach is depicted in Fig. 2. Essentially, the residual signal serves a signal for the detection of a fault in a power plant. If a fault occurs, its value will increase. Two phases exist in the proposed fault detection scheme, which are (1) the phase of system identification, and (2) the phase of fault detection. The system identification exercise aims to represent the nonlinear dynamics of the power plant that is indicative of a healthy operation. The trained neural networks then represent the

1) SYSTEM IDENTIFICATION PHASE
To ensure a successful FDD system, the system identification phase must be executed appropriately. As a result of this phase, the five neural networks learn about the dynamics of the non-faulty power plant. There are three steps to achieve this goal: training, validation and testing. The training exercise is performed using the Levenberg-Marquardt (LM) algorithm. The testing result of one of the trained neural networks corresponding to the pressurizer pressure output is shown in Fig. 3.

2) FAULT DETECTION PHASE
Once the neural networks have been trained, residual signals can be generated based on the trained networks. The residual signal represents the difference between the output of the neural network and corresponding actual output of the power plant. The presence of a fault in the power plant will increase the difference between these two outputs; therefore, the fault is detected by monitoring the residual signal by considering an appropriate threshold.

A. DATA COLLECTION
To solve the fault classification problem, the data of pressurizer pressure, pressurizer level, reactor power, steam pressure, turbine speed, and the residuals generated with the help of the neural networks are used. To make sense of the data, the six output variables were collected for each type of the fault (see Table 2) for 50 simulation runs and a data sampling rate of 1000 samples/s. As a result of this sampled data, the range of each sensor was preprocessed to [0, 1] to avoid polarization during training. Hence, the measurements of each sensor are normalized using minmax scaling, which is commonly used in machine learning applications, as follows: where x s is the normalized measurements of the sth sensor, and x max and x min are the minimum and maximum of the training dataset for measurements of the given sensor. Because the datasets are too large for a personal computer to handle, they are then downsampled to 100 samples per second. Finally, the data are reshaped into a vector matrix.

B. CLASSIFICATION ALGORITHM
In this study, three families of classification algorithms from the MATLAB Classification Learning Toolbox were selected to evaluate their suitability for the fault classification of PWR-NPP actuators and sensors. KNN, SVM (support vector machine)-, and ensemble-based classifiers are the algorithms used for classification. The kNN approach, which is commonly used for pattern classification, determines the class of a new object by examining its distance from its nearest neighboring training samples [21]. The KNN method classifies an unlabeled sample based on its similarity to training set samples. Numerous applications of the KNN method have been developed in data mining, statistical pattern recognition, and image processing. Recently, the KNN method was applied for fault detection in the process industry [22]. However, KNN has rarely been applied to fault classification because of the difficulty in identifying possible faults and including them in the training data [22], [23], [24]. A review of the basic concepts of the KNN approach for identifying patterns is presented in this section. For example, for a given unlabeled sample x, KNN methods based on distance metrics find the k-nearest labeled samples in the training data set. Distance metrics are used to define how far individuals are from each other. It is common for kNN algorithms to use Euclidean distance, even though several other distance metrics have also been proposed. For example, if p and q are Euclidean points and it is assumed that p = (p 1 , p 2 , p 3 , p 4 , . . . , p n ) and q = (q 1 , q 2 , q 3 , q 4 , . . . , q n ), then, the Euclidean distance can be expressed as follows [25]: SVM is a machine-learning algorithm that uses structural risk minimization and statistical learning for classification and regression [26]. Many applications have successfully employed the SVM method to separate the data into two or more classes. The purpose of using an SVM is to determine the optimal hyperplane that separates data points into two classes. Optimal hyperplanes maximize the separation margin between the two classes. Therefore, the SVM is mainly utilized for classifying linearly separable datasets.
The optimal hyperplane can be expressed mathematically as follows [2]: where x is the input vector, w is the weight vector, and b is the bias vector. The support vector equation for each class is as follows: where d i corresponds to the respective class, i.e., d i = +1 for class A, and d i = −1 for class B. The optimization problem for the training sample to find the optimal hyperplan is given as Following is the final decision function: where x represents the input vector to be classified, and N represents the number of support vectors obtained during training. Support vectors are defined based on non-negative parameters alphas α 0,i . In order to categorize the linearly nonseparable pattern, a mapping function φ(x) transforms the data into a higher dimensional feature space. A modification of (20) can be made as follows: Kernel functions computed over high-dimensional spaces are used to reduce their complexity. These are defined as K (x, y) = φ(x)φ(y). The following updates can be made for the decision function: As far as nonlinear cases are concerned, they cannot be adapted. Therefore, nonlinear transformations are performed using the kernel functions. By mapping a nonlinearly separable object into a higher-dimensional feature space, the kernel functions make it linearly separable. Linear kernels, polynomial kernels, and Gaussian radial basis function kernels are examples of common kernel functions used in the literature, as shown in Table 3 [27], [28]. An ensemble classifier enhances the accuracy of predictions by combining numerous diverse classes. Each classifier is trained separately, and the resulting trained classifiers are combined. The classifiers contain a set of learning algorithms that classify the new data points based on the weight of their predictions. Combined ensembles may be trained later as single hypotheses, and not necessarily constrained by the VOLUME 10, 2022  [27], [28].
hypotheses from which they are derived. Overfitting may occur as a result of this flexibility; bagged trees overcome this problem by training classifiers in different partitions and combining them through a majority vote. An improved prediction accuracy is achieved when the correlation of the errors of a single classifier is weaker [29], [30].

C. CLASSIFIERS FROM THE TOOLBOX
The MATLAB Classification Learner toolbox was used to train the models to determine the classification of data using supervised machine learning. In this study, fault diagnosis was performed using SVM-, KNN-, and ensemblebased classification methods provided by the toolbox. A list of the 15 selected classifiers is provided in Table 6.

V. SIMULATION RESULTS AND ANALYSIS
Towards achieving fault diagnosis, two tasks must be completed. We first present the neural network learning phase, in which neural networks learn the input-output dynamics of the power plant. Second, we present the results of the fault diagnosis analysis, which includes fault detection and fault isolation.

A. TRAINING THE NEURAL NETWORKS
The neural network described in Section III was used to identify the different subsystems: pressurizer pressure loop (NN pp ), pressurizer level loop (NN pl ), reactor power loop (NN re ), steam generator loop (NN sg ), and turbine-speed loop (NN ts ). For brevity, only the identification of the pressurizer pressure loop is discussed herein. Pressurizer loop identification was performed using 3000 input data samples. The pressurizer demand was considered as a random step input signal and the pressurizer pressure was considered as a target variable. There are three partitions for the identification data: training data, validation data, and testing data, where 70%, 15%, and 15% of the data were used for each of them. The neural network was trained using the   LM algorithm, and the largest improvement was obtained for seven neurons in the hidden layers. This procedure was applied to all other loops, and Table 4 summarizes the inputs and outputs of all networks. Fig. 4 shows the performance regression between the predicted and target values of the NN pp model. The regression values were seen to be close to 1, which confirmed that the NN pp model can successfully reproduce the PWR transient. The performance of the identified NN pp model is illustrated in Fig. 5. It can be observed that the mean square error value decreased with epochs. This confirmed the good performance of the identified NN pp .

B. FAULT DETECTION ANALYSIS
The faults were injected in the transient state of mode of the PWR plant. Different faults were injected into the power plant to determine the severity of the fault that must be detected according to the chosen threshold. Here, one fault case is considered as an example: the bias fault in the pressurizer pressure sensor (F11).

1) FAULT SCENARIO F11
A bias fault of +0.04 bar was injected into the pressurizer pressure sensor at t = 170 s. Fig. 6 shows the variation in the pressurizer pressure during the fault. Fig. 7 shows the residual signal corresponding to N pp . After the fault occurred at t = 170s, the output transient appeared to change, but the error was quickly corrected, as the controller tracked back to the set-point after 10ms. The fault detection time was t = 170.002 s.

C. FAULT CLASSIFICATION ANALYSIS
In this study, the data collected in the previous section were used to train the robust-machine learning classifiers such as SVM (linear, quadratic, cubic, medium Gaussian, fine Gaussian), KNN (medium, coarse, cosine, cubic, weighted); and Ensemble (boosted trees, bagged trees, RUS-boosted tree, subspace discriminant, subspace KNN). For training and validation purposes, the fivefold cross-validation was employed. The fault-diagnosis accuracies of the classifiers are shown in Fig. 8. It was found that ten classifiers (quadratic SVM, fine Gaussian SVM, medium Gaussian SVM, medium KNN, coarse KNN, cosine KNN, cubic KNN, weighted KNN, bagged trees, and subspace KNN) offered outstanding performance in terms of accuracy, with most of them generating 100% classification accuracy. However, not all the selected classifiers are suitable for fault diagnosis. The accuracies of the boosted trees and subspace discriminant classifiers were below 50%. In the worst case, the RUS-boosted trees had a classification accuracy of only 35.2%.
In this study, confusion matrix and receiver operating characteristic (ROC) curve were used to assess the performance of the classifiers. A confusion matrix is a table that depicts and summarizes the performance of a classification algorithm to determine its efficiency. For brevity, only one example of the confusion matrix for the coarse KNN is provided in Fig. 9, where the rows are the true class, columns show the predicted class, and diagonal cells indicate where the true class and predicted class coincide. It is possible to use the confusion matrix to calculate accuracy, precision, and recall, which can be represented as follows [30]: where TP and TN are true positive and true negative, respectively, and FP and FN are, false positive and negative, respectively. As shown in Fig. 9, all the 20 faults were all classified correctly. With an accuracy of 94.3%, the faults belonging to F7 were the least accurately classified, whereas the F2 and F3 faults were the most accurately classified at 99.8%. The overall classification performance was found to be 98%. The ROC curves present a confusion matrix in graphic form. The ROC curve is created by plotting the true positive rate (TPR), or sensitivity, against the false positive rate (FPR), where the TPR and FPR are represented as used in [25]: The ROC graph presented in Fig. 10 illustrates the performance  of the coarse KNN to determine the classification of F1. Based on the ROC curve shapes, the coarse KNN algorithm successfully classified F1 based on the area under the curve (AUC) of 1. Table 5 summarizes the AUCs of different classifiers. For most classifiers, the AUC average was high, except for the subspace discriminant, RUSBoosted trees, and Boosted trees algorithms, although the latter had a moderate level of accuracy. The KNN-based algorithms were found to be the most accurate methods, where they also required the least computational cost (measured in terms of execution time) compared with the SVM and ensemble algorithms. The computational time requirements of the SVM algorithms were significantly higher than those of the other algorithms.

VI. CONCLUSION
A machine-learning algorithm was proposed for the FDD of sensors and actuators in the entire PWR-NPP. First, neural networks were used to detect different faulty scenarios. Second, KNN, SVM and ensemble-based fault diagnosis methods were presented and their performances in fault classification were compared. The conclusion can be drawn that, while 10 classifiers were able to classify the 20 faults, the KNN algorithms were found to have the most accurate classification of sensor and actuator faults. In addition, the KNN algorithms had the lowest computational cost among the compared techniques. Table A1 presents the description of the different classifier types. Table A1. Classifiers from MATLAB machine learning toolbox [31].