A Real-Time Conﬁguration Approach for an Observer-Based Residual Generator of Fault Detection Systems

: This paper is concerned with the real-time conﬁguration of fault detection systems by exploiting an gradient optimization scheme. It is known that industrial processes may often en-counter some uncertainties or changes of operating points and environment, which would lead to an unsatisfactory fault detection result. To handle this problem, a real-time (or online) conﬁguration strategy is introduced, which plays an important role in ensuring the efﬁciency of the fault detection method without a high industrial cost. In this paper, a gradient-based iterative optimization scheme is taken into account for the real-time conﬁguration implementation. By utilizing the gradient-based iterative algorithm to minimize the K-gap between the residual generator and the current system, the parameters of the residual generator can be conﬁgured from the online input/output data. Based on this, real-time conﬁguration of the residual generator parameters is achieved and, correspondingly, the fault detection performance is guaranteed. Then, a three-tank system, which is relatively common and important in chemical industrial systems, is studied and explored to verify the effectiveness and superiority of the gradient optimization conﬁguration strategy proposed in this work.


Introduction
With the rapid development of industrial technology, increasing attention has been paid to certain safety and reliability problems, prompting further research on fault detection. Among the research of fault detection problems, model-based methods have been intensively studied, and considerable results have been reported during the past few decades [1][2][3][4][5][6][7][8][9]. To mention a few, by transforming the residual generator design problem into an optimization problem, an optimal periodic fault detection approach is obtained for linear discrete-time periodic systems in the light of robustness and sensitivity [10]. The definitions of finite horizon H ∞ /H ∞ and H − /H ∞ fault detection performance are first established for linear discrete time-varying systems, based on which the fault detection issue is dealt with by designing some observer gains [11]. The sensor stuck faults are considered for a class of stochastic systems, and a fault detection method is proposed in the stochastic framework to guarantee the effectiveness for arbitrary small sensor stuck faults [12]. Considering the linear system with elliptical uncertainties, a general parametrization is employed for less conservativeness and then a fault detection filter is designed to maximize the sensitivity of fault detection with a certain disturbance attenuation demand [13]. To make a balance between the sensitivity and robustness, a mixed H − /H ∞ performance index is taken into account, and sufficient criteria are presented to achieve the fault detection observer design for a class of piecewise linear systems with weighted H − /H ∞ performance [14]. On the basis of linear system study, the model-based fault detection based predictor, an adaptive updating strategy is proposed for the fault detection filter of solar power generation systems with uncertainties [32]. Via adopting an autoregressive exogenous model to represent the dynamic process, an adaptive data-driven method is developed for fault detection of dynamic process with process drift [33]. The adaptive algorithm provides an effective way for the online configuration of data-driven residual generators, while each new measurement is utilized for the parameter estimation, and the parameter updating in the adaptive configuration happens at every sampling instant. Moreover, the configured system matrix of the adaptive method may be sensitive to small changes in the parameters. Compared with the adaptive configuration, the residual generator parameters based on the iterative optimization method remain unchanged between two iterations, which would greatly reduce the iteration number and meanwhile guarantee the fault detection performance [34,35]. However, the existing results about the online optimization configuration for the observer-based residual generators are quite limited, which motivates the current study.
Based on the observations above, this paper is aimed to investigate the real-time configuration for fault detection systems via the gradient optimization method. Considering the unavoidable changes of the industrial process and operating environment, it is necessary to establish a real-time configuration method to properly configure the residual generator parameters to guarantee fault detection ability. To achieve the real-time configuration, a gradient-based iterative optimization strategy is proposed by minimizing the K-gap metric between the residual generator and the current system. In this way, the residual generator can be updated from the available input/output (I/O) data without the identification of system matrices. A novel optimization algorithm for the real-time configuration of residual generators is developed, by which the validity of the fault detection process is guaranteed. Furthermore, a three-tank system plant is taken into account to illustrate the usefulness and advantages of the proposed approach, which can be seen as the prototype for many industrial processes, such as chemical process industries.
The structure of this paper is organized as below. In Section 2, the system descriptions and necessary preliminaries are provided. Section 3 presents the gradient optimization to achieve the online configuration for fault detection systems. In Section 4, a simulation example is used to demonstrate the effectiveness of the obtained method. Finally, the conclusions of this work are drawn in Section 5. Notation 1. Throughout this paper, the notations are generally standard. R n and R m×n , respectively, denote the n-dimensional Euclidean space and the set of all m × n real matrices. H ∞ is the set of all stable transfer functions and H 2 is the subspace of all signals with bounded energy equal to 0 for any t < 0. RH ∞ defines the set of all real-rational transfer functions of stable systems. · 2 and · ∞ stand for the L 2 -norm and the H ∞ -norm, respectively. vec(A) indicates the vectorization of matrix A.σ(A) and eig(A) represent the maximum singular value and the maximum eigenvalue of matrix A, respectively. A + denotes the pseudoinverse of matrix A. diag{· · · } defines a diagonal matrix.

System Descriptions
Consider the discrete-time linear time-invariant (LTI) system represented by where x(k) ∈ R n is the state vector, u(k) ∈ R l is the input signal, and y(k) ∈ R m is the system output. A, B, C, D are system matrices with proper dimensions.

Stable Kernel Representation
For the nominal system (1) and (2), its transfer function representation is given by Then, the stable kernel representation of G(z) is described as below. Consider a proper real-rational transfer function matrix G(z) with the following left and right coprime factorizations: ) are, respectively, left and right coprime pairs over RH ∞ . It means that there ∞ such that the following equations hold: then they are called the normalized left and right coprime pairs, respectively.

Definition 1 ([35]
). Given a discrete-time LTI system G(z) in Equation (3), a stable linear system K is called the stable kernel representation (SKR) of G(z), if for any u(z) and its response y(z), the following equation holds: Suppose that r(z) is the residual signal of the underlying system. According to the description of the left and right coprime factorizations, it is clear thatM(z) andN(z) correspond to the transfer matrices from the residual signal to the output signal and the input signal, respectively. Then, the following equation holds in the fault-and noisefree case: Accordingly, a SKR of system G(z) can be formed by the transfer matrices as below,

K-Gap Metric
To achieve the optimization objective, it is necessary to introduce a means to measure the distance between two kernel subspaces. As the K-gap metric has become a powerful tool in dealing with the measurement problems, this paper will adopt the K-gap metric technique for the optimization process. Before mentioning the K-gap metric, the gap metric concept is first restated for clarification. For this purpose, the graph definition is introduced and represented by Note that the graph G is a subspace in H 2 constructed by all the pairs (u, y), and it is closed [36,37]. Denote G 1 = N 1 M −1 1 , G 2 = N 2 M −1 2 as the normalized right coprime factorizations of G 1 , G 2 , respectively. Let G 1 , G 2 be the corresponding graphs. The direct gap from G 1 to G 2 is defined as δ(G 1 , G 2 ), which is formulated by According to the work in [36], the calculation on the direct gap (6) can be solved by Based on above, the definition of gap metric between G 1 and G 2 is derived as Considering that the gap metric is based on the image subspace, the K-gap metric defined on the kernel subspace is further proposed. The corresponding graph is defined as which indicates the kernel subspace and is a closed subspace in H 2 . Similarly, the directed K-gap from graph K 1 to graph K 2 is expressed as follows.

Definition 2 ([37]
). Suppose that M 1 (z),N 1 (z) , M 2 (z),N 2 (z) are the left coprime factorizations of G 1 (z), G 2 (z), respectively, and The directed K-gap from K 1 to K 2 is defined by Subsequently, the K-gap metric between K 1 and K 2 is given by Moreover, a computation strategy of the K-gap metric is also established in [37], which is recalled in the following lemma. Lemma 1 ([37]). Consider K i , i = 1, 2 defined in Definition 2 with normalized left coprime factorizations M i (z),N i (z) , i = 1, 2. The direct K-gap can be computed by It can be yielded from Lemma 1 that and when δ k (K 1 , K 2 ) < 1,

Data-Driven Framework
As the input and output data are crucial to the fault detection realization, the data model is introduced here for latter development. Taking a data vector λ(k) ∈ R κ into account, the related notations are defined as below.
where s, N are positive integers and s + 1 is the length of the stacked data vector. Based on the data structure, the data-driven realization of the SKR is defined as follows.

Definition 3 ([20]
). K d,s is called a data-driven realization of the SKR for system G(z), if for all k ≥ 0, the following equation is satisfied: Note that if the data-driven SKR is satisfied with K d,s K T d,s = I, then it is called normalized [38]. By applying the singular value decomposition, it holds that and thus, the normalized data-driven SKR for system G(z) is derived as Next, the data-driven realization of the K-gap metric is presented on the basic of the normalized data-driven SKR.

Lemma 2 ([39]
). Suppose thatK 1,d,s ,K 2,d,s are the normalized data-driven SKRs of SKRs K 1 , K 2 . The data-driven realization of the K-gap metric can be calculated by

Main Results
Considering that practical circumstance and industrial environment may change, the fault detection by the offline designed residual generator cannot satisfy the complicated industrial demand. In this section, a novel real-time configuration scheme for residual generators is proposed, which is essentially an optimization algorithm based on the K-gap metric. To be specific, an observer-based residual generator is constructed and the gradient optimization algorithm is used to update its parameters. Thus, the real-time configuration is achieved for the observer-based residual generators, the framework of which is displayed in Figure 1

The Observer-Based General Generator
For the discrete-time LTI system (1), a full-order state observer is constructed with the minimal state-space representation as where x o (k) ∈ R n indicates the state of the full-order observer and r(k) ∈ R m stands for the residual vector. For observer (9) and (10), a similarity transformation is performed by x o = T ν x ν , which yields where According to the authors of [40], the controllability Gramian matrix of systems (11) and (12) is equivalent to the identity matrix, i.e., which gives rise to a column-orthogonal matrix Referring to the literature [41], the parameterization based on the input normal form can be described by in which θ AB ∈ R nl and its entries take values in the range (−1, 1). By introducing the following form for each parameter θ AB (i), i = 1, · · · , nl As the parameterization of the input normal form is on the basis of the asymptotic stability, no additional restriction on the parameter space is needed, which is a significant advantage of this transformation.
Then, the procedure to obtain the SKR corresponding to the observer (11) is given as below. It is obvious from Formula (12) that Subsequently, Then, it is easy to obtain that where Then, the following equation is obtained: As C ν A s ν → 0, s → ∞, according to Definition 3, the SKR corresponding to the state observer can be obtained by the equation with removing the front finite rows to eliminate the influence of past data. By applying the singular value decomposition to K o,s , it holds that and thus, the normalized SKR isK

Online Gradient Optimization
Based on the above observer-based residual generator, this subsection will establish an gradient optimization method for the real-time configuration by taking advantage of the K-gap metric between the observer and system plant. Define and denote θ i (i = 1, 2, · · · , τ = nl + 2mn + ml) as the i-th term of θ.
The optimization problem is described by where K d,s , K o,s are, respectively, the SKRs of the system (1) and the observer (11), and S is the set in which the entries of any vector belong to (−1, 1). To achieve the minimization of cost function J, the Taylor expansion of cost function J at the j-th iteration is considered T denote the gradient and the Hessian matrix of cost function J, respectively. o 3 (·) stands for the infinitesimal of order higher than 3. Regardless of the high-order infinitesimal, a necessary condition to minimize the function J Rewriting the expression (17) gives the iteration procedure of updating the parameter θ as which is the Gauss-Newton iteration widely used in the literature. However, this method requires the invertibility of and may lead to a heavy computational burden. To improve its applicability in numerical computation, an iteration procedure known as the steepest-descent algorithm is introduced where ∆ (j) > 0 is a diagonal matrix meaning the step length of the j-th iteration.
Denote ξ as the eigenvector corresponding to the maximum eigenvalue of matrix Making use of the result of singular value decomposition in (16) gives where V 1 = v 1 v 2 · · · v µ and µ means the row number of matrixK o,s . Therefore, where Σ 1 = diag{σ 1 , σ 2 , · · · , σ µ }. As a result, v α is the eigenvector corresponding to the i-th eigenvalue of matrix K T o,s K o,s . For any α = 1, 2, · · · , µ, i = 1, 2, · · · , τ, It can be easily obtained that Substituting the Formula (15) into the partial derivative leads to As θ i may be one element of any vector of θ AB , θ C ν , θ D ν , θ L ν , the deduction will be divided into four cases in the following.
Up to now, the optimization problem is solved and the parameter optimization is derived by the above deduction. To summarize, this study aims to achieve the online configuration of an observer-based residual generator for fault detection systems. To achieve this, the observer is first transformed into the input normal form, which guarantees the asymptotic stability. Based on the input normal form, the residual generator is established, and the purpose is to online configure its parameters to cope with the operation condition changes or uncertainties of the system. Then, the optimization configuration strategy is taken into account and the optimization problem is proposed by utilizing the K-gap metric concept. By employing the gradient descent method, the parameter configuration is finally obtained for the online configuration realization.

Remark 1.
Note that the optimization problem of this paper is established based on the K-gap metric concept. The purpose is to minimize the K-gap metric δ k d,s (K o,s , K d,s ) between the observer and system plant, which characterizes the distance between two kernel subspaces. Referring to the work in [37], a definition of cluster is described as below. For δ f ∈ (0, 1), the set is called C f cluster with the cluster center K f and cluster radius δ f . From this point of view, by minimizing the K-gap metric δ k d,s (K o,s , K d,s ), the obtained K o,s falls into the cluster with the cluster center K d,s and a certain cluster radius. A smaller cluster radius contributes to a more similar level of K o,s to K d,s . Therefore, the residual generator based on the optimized K o,s can guarantee the reliability and efficiency of the fault detection system.

Online Configuration Realization of Fault Detection
This subsection will present an online algorithm to achieve the fault detection goal by employing the newly proposed gradient configuration scheme. The detailed procedure of online configuring the observer-based residual generator is described in Algorithm 1 as follows.
To achieve the fault detection, the evaluation function is set to be J (k) = r(k) 2 2 with the threshold J th chosen as below,

Algorithm 1 Online Configuration of Observer-Based Residual Generator
Step 1: Collect the I/O data u(k), y(k) at each k and select an iteration interval W Step 2: Execute Step 3-6 for the j-th iteration every W Step 3: According to Definition 3, compute the SKR K d,s and its normalized resultK d,s Step 4: Compute the SKR K o,s and its normalized resultK o,s corresponding to the observer by (15) and (16) Step 5: Apply Lemma 2 to obtain the K-gap metric δ k d,s (K o,s , K d,s ) between K o,s and K d,s Step 6: Given a scalar ε, if δ k d,s (K o,s , K d,s ) > ε, compute the gradient and update the parameters of residual generator according to (19), increase j by 1 and return Step 2, otherwise the configuration ends

Simulation Experiment
In this section, a simulation experiment is carried out on a three-tank system plant to show the effectiveness and advantages of the proposed real-time configuration scheme. Figure 2 shows the schematic diagram of the three-tank system, which is composed of three water tanks and some connecting pipes. In Figure 2, h 1 , h 2 , and h 3 refer to the water levels of the three tanks, which are measurable through sensors and deemed as the output signals. Q 1 and Q 2 stand for the incoming mass flow rates of Pump 1 and Pump 2 and are used as the input signals. Besides, PV 1 , PV 2 , PV 3 , LV 1 , LV 2 , LV 3 are the adjustable ball valves to administrate the opening and closing of these pipes.
The system plant can be represented by the nonlinear dynamics in which A = 154 cm 2 and s = 0.5 cm 2 denote the cross section area of the tanks and pipes, respectively, and α 1 = 0.46, α 2 = 0.60, α 3 = 0.45 successively indicate the coefficients of flow for the three pipes. In addition, the maximum height of the tanks is chosen as H max = 62 cm, and the maximum flow rates of pumps 1 and 2 are set to be Q 1max = Q 2max = 100 cm 3 /s. For certain operation points, the nonlinear representation (21) can be reformulated into the LTI system (1) by utilizing the linearization technique. In this simulation, the operating time is set to be 25,000 s and the sampling period is chosen as 1s. At first, the operation point of the three-tank system is considered to be h 1 = 45 cm, h 2 = 15 cm, and h 3 = 30 cm, for which a residual generator is predesigned and applied in the fault detection process. Due to the demand of practical industry, it is supposed that the operation point changes to h 1 = 50 cm, h 2 = 46 cm and h 3 = 48 cm at 6000 s. The process data are collected and displayed in Figure 3. Figure 4 displays the evolution curves of residual signals and evaluation function and Figure 5 exhibits the K-gap metric between system plant and observer. Before the change of the operation point at 6000 s, the evaluation function value is lower than the threshold and the K-gap metric value is 0.0007072, which means the kernel subspaces of system plant and observer are sufficiently close and thus the predesigned residual generator is proper. From 6000 s, the value of evaluation function increases and obviously exceeds the threshold, which causes a false alarm under the circumstance of no fault. Meanwhile, the K-gap metric between system plant and observer becomes enormous. Clearly, the predesigned residual generator is no more applicable for the system with a changed operation point. To handle this problem and demonstrate the validity of the proposed real-time configuration method, the real-time configuration algorithm, i.e., Algorithm 1 is implemented at 9000 s. It can be observed from Figures 4 and 5 that from 9000 s, the K-gap metric value begins to decline as the real-time configuration implementation, and the values of residual signal and evaluation function, begin to decrease and gradually converge. At~14,700 s, the K-gap metric settles at~0.001 and the kernel subspace of observer is adequately approximate to the kernel subspace of system plant. In addition, the value of evaluation function becomes less than the threshold and the false alarm disappears, which reflects that the real-time optimized residual generator is effective for the current operation point. Therefore, the optimization goal is realized and the real-time configuration of the residual generator is achieved for the system. In addition, the optimized parameters of θ AB , θ C are, respectively, given in Figures 6 and 7 to show the parameter configuration process.     Now, the online configured residual generator is applied to the fault detection implementation to verify its usefulness. Here, two types of fault will be considered and assumed to happen at 23,000 s, respectively. First, consider that a leakage fault happens in the tank 2 with a 20% leakage level at 23,000 s. Figure 8 shows the fault detection result by the online configured residual generator. It can be seen from the figure that the value of the evaluation function exceeds the threshold at 23,005 s, which means that the leakage fault is detected. Then, the usefulness of the fault detection based on the online configuration scheme is illustrated. Moreover, another type of fault, i.e., a drift fault with slope 0.01 occurring in the sensor of water level of tank 2, is considered at 23,000 s. Figure 9 shows the corresponding fault detection result, from which one can see that the drift fault is detected by the proposed optimization configuration algorithm at 23,042 s. According to the above fault detection results, it is clear that the optimization configuration method of this paper can detect the fault accurately and timely. As a consequence, the real-time configuration method proposed in this paper can effectively deal with the system under the influence of operation point changes or uncertainties, and the effectiveness of the method in fault detection implementation is demonstrated.

Conclusions
Considering that the changes of operating conditions, practical environment, and some uncertainties may occur in industrial processes, this paper is dedicated to the realtime configuration design for fault detection systems. As an important means of realtime configuration, the gradient optimization scheme is considered and adopted in this work for the real-time configuration implementation. A novel optimization algorithm is developed by virtue of the gradient-based technique, in which the K-gap metric between the residual generator and the current system is minimized. Then, the residual generator parameters can be updated based on the I/O data, and the real-time configuration for fault detection systems is realized to satisfy a particular demand. Finally, the usefulness and merits of the proposed approach are demonstrated through the benchmark case on a three-tank model. One main advantage of this work is that by virtue of the K-gap metric technique together with the gradient-based method, the online-configured residual generator parameters are reliable to guarantee the fault detection performance for industrial systems with changeable operating points. Besides, the input/output data information are sufficiently exploited for the fault detection implementation, which avoids the difficulties of the system identification in practice. As the real-time configuration method is carried out based on the process data, the computation amount would be the main concern of the implementation, especially for large-scale industrial systems, which inspires us to conduct further research in this field. Note that one of the main contributions of this paper is to introduce the K-gap idea into the real-time configuration implementation, which exploits the essential characteristic of fault detection systems. In our future work, the K-gap-based optimization configuration approach will be further extended to systems with nonlinearities and fault-tolerant control issues.