A Data-Driven Scheme for Fault Detection of Discrete-Time Switched Systems

This paper is concerned with the fault detection issue for a class of discrete-time switched systems via the data-driven approach. For the fault detection of switched systems, it is inevitable to consider the mode matching problem between the activated subsystem and the executed residual generator since the mode mismatching may cause a false fault alarm in all probability. Frequently, studies assume that the switching laws are available to the residual generator, by which the residual generator keeps the same mode as the system plant and then the mode mismatching is excluded. However, this assumption is conservative and impractical because many switching laws are hard to acquire in practical applications. This work focuses on the case of switched systems with unavailable switching laws. In view of the unavailability of switching information, the mode recognition is considered for the fault detection process and meanwhile, sufficient conditions are presented for the mode distinguishability. Moreover, a novel decision logic for the fault detection is proposed, based on which new algorithms are established for the data-driven realization. Finally, a benchmark case on a three-tank system is used to illustrate the feasibility and usefulness of the obtained results.


Introduction
With the increasing complication of industrial systems, high requirements are brought with the safety and reliability, which are critical to the stability and system performance. As is well known, fault detection has served as an effective tool to guarantee the safety and reliability of dynamic systems. Nowadays, the study on fault detection has drawn considerable attention from the literature [1][2][3][4][5][6][7][8][9]. The model-based fault detection takes up an important role in the fault detection field. By constructing the process model, the analysis and control issues have been excessively studied and numerous results of the model-based fault detection have been reported, see, e.g., [10][11][12][13][14] and the references therein. Recently, with the rapid development of communication technology, data-driven methodologies have been extensively addressed for the fault detection problems. Different from the model-based methodology, which requires a time-consuming and complicated modelling process from practical applications, the data-driven methodology gets rid of the modelling complexity and meanwhile sufficiently exploits the process data information. Therefore, great efforts have been made for the data-driven fault detection of various dynamical systems and practical applications, see, e.g., [15][16][17][18][19][20][21] and the references therein.
Moreover, increasing interest has been paid to the research on switched systems owing to their capacity in modelling the systems with switching behaviours [22][23][24][25][26][27][28][29][30][31]. As is known, a switched system usually consists of a finite number of distinct subsystems and a law governing the switching dynamics between these subsystems. The application of switched system models is rather widespread, such as flight control systems, communication systems, automotive industry and many other areas. Up to date, much research has been done on the analysis and synthesis of switched systems. For instance, the stability analysis and controller design are investigated for switched systems with constrained switching signals by exploiting the Lyapunov theory in [32][33][34][35]. Moreover, the switched systems with random switching signals are also considered and addressed to deal with the stability and stabilisation issues, such as [36][37][38].
As for the fault detection of switched systems, some results are available in the literature, see, e.g., [39][40][41][42]. It is worth mentioning that most of the existing results for the fault detection of switched systems are carried out on the assumption that the switching law is known and switching information is acquired to the residual generator. Based on this assumption, the modes between subsystem and residual generator are perfectly matched, which thus excludes the influence of system switching on the fault detection. In [43,44], the model-based approaches are investigated for switched systems with the determinate switching law, and in [45], a combination of switching observer and Bond Graph method is proposed while the switching signal is known. In [46,47], parity space method is applied to fault detection of the switching system, but the possibility that the switching signal is unknown is not considered. However, it is more frequent that the switching laws cannot be known or acquired in practice. In this case, the assumption of the switching information available to the residual generator is no longer applicable. Therefore, this work aims to cope with the fault detection for switched systems with unavailable switching laws.
Based on the discussion above, this paper focuses on achieving the data-driven fault detection for a class of discrete-time switched linear systems. Different from existing results, it is assumed that in this paper, the switching laws cannot be available to the modedependent residual generator. In this case, the mode mismatching between subsystem and residual generator may occur in the fault detection process, which may lead to incorrect residual signals and thus cause a false fault alarm. To handle this problem, the mode recognition is taken into account and sufficient criteria are proposed to ensure that the modes of the switched system are distinguishable. A novel decision logic including the mode recognition is developed in the data-driven fault detection, which avoids the false fault alarm caused by the mode mismatching and thus improves the accuracy of the fault detection. Then algorithms are presented to show the procedures of offline computation and online detection. The effectiveness and advantages of the developed method are demonstrated by the case study on a three-tank benchmark system. The paper is organised as follows. Section 2 provides the system descriptions and some preliminaries. In Section 3, the main results are presented including the sufficient criteria of mode distinguishability and novel algorithms for data-driven fault detection. Section 4 utilises the benchmark study of a three-tank model to illustrate the effectiveness and Section 5 concludes this work.
Notations. The notations used in this paper are standard. R n means the n-dimensional Euclidean space. RH m×n ∞ stands for the set of all m × n-dimensional real-rational transfer functions of stable systems. N + represents the set of all positive integers. H 2 defines the subspace of all signals (k) satisfying (k) = 0 for t < 0 and energy boundedness. · 2 is the Euclidean norm. σ max (·) defines the maximal singular value of a matrix. The superscript "T" represents the transpose of a matrix and the superscript "⊥" represents the orthogonal complement. The dimension of a matrix is assumed to be compatible with algebraic operations if it is not explicitly stated.

System Descriptions
This paper investigates the discrete-time switched linear system as below where x(k) ∈ R n x , u(k) ∈ R n u , y(k) ∈ R n y respectively denotes the system state, input and output signals. The symbol σ(k) defines the switching signal which is a piecewise constant function taking values in a finite set £ = {1, 2, · · · , M}. M(∈ N + ) stands for the number of subsystems. ξ(k) and ν(k) stand for the system and measurement noise vectors which are normally distributed and statistically independent from x(0) and u(k). In the following, A i , B i , C i , D i are used to represent the system matrices For system (1) with ξ(k) = 0, ν(k) = 0, its transfer matrix G i (z), i ∈ £ describes the input-output behaviours of the system in the frequency domain as follows where z is the complex variable. From the state space representation (1), there holds that and usually, it is denoted that

SKR-Based Residual Generators
Assume that G i (z), i ∈ £ is a proper real-rational matrix. The left and right coprime factorisations are represented by where The stable kernel representation (SKR) for each subsystem of system (1) is defined as follows. Definition 1. For given system G i (z), i ∈ £, if for any input u(z), it holds that then the stable linear system K i is called a SKR of G i (z).
It can be easily derived from the left coprime factorization in Equation (2) that Let r i (z) be the residual signal of G i (z), i ∈ £. The SKR-based residual generator is given by

K-Gap Metric
For the fault detection of systems with multiple modes, to measure the distance between the kernel subspaces of different modes is necessary. As is known, the K-gap metric works as an effective tool in measuring the distance between two kernel subspaces. Hence, this subsection introduces the concept of the K-gap metric. Firstly, the graph of subsystem G i , i ∈ £ is defined by which is a closed subsystem in H 2 representing the kernel subspace of G i . The definition of the directed K-gap between two different graphs K i and K j , i = j is described as below.

Definition 2 ([48]
). For any i = j, the equation Further, the K-gap metric of K i and K j is defined by

Structure of Data Matrices
In this subsection, the data structure is presented for the data-driven design of the fault detection in the latter text. For input u(k) and output y(k), define the following stacked data vectors where s ∈ N + is the data length. For a given N ∈ N + , the Hankel matrices and the extended state vector are defined by Moreover, the past and future Hankel matrices are denoted by The data-driven SKR for each subsystem of system (1) is presented based on the data structure.
then the matrix K i,d,s is called a data-driven realisation of the SKR of G i (z).
According to the formula (3), the data-driven residual generator is obtained as

Problem Descriptions
This paper is concerned with the data-driven fault detection for discrete-time switched systems with unavailable switching laws. It is noteworthy that in the literature, most studies on the fault detection of switched systems are carried out on the assumption of the switching law availability. As shown in Figure 1, the available switching signal is transmitted to the system plant and residual generator simultaneously. In this case, the residual generator keeps the same mode with the system plant to generate the residual signal for fault detection, which in other words means that the system switching has no influence on the fault detection implementation. However, in engineering practice, it is more likely that the switching laws of a switched system cannot be known or acquired. For the switched system with unavailable switching laws, the fault detection becomes more complicated and challenging because of the possible mode mismatching between subsystem and residual generator. For example, when the system plant is activated in the mode i, the residual generator may work in the mode j(i = j ∈ £) because of the unavailability of the switching laws. The mode mismatching between subsystem and residual generator may cause a terrible effect on the residual signal and thus the evaluation function. Even in the fault-free case, the evaluation function exceeds the threshold and a fault alarm is triggered. To handle this problem, this work establishes a set of decision logic as shown in Figure 2, in which the mode recognition is taken into account in the fault detection implementation. Thus, the mode mismatching influence is eliminated and the accuracy of the fault detection is improved. It is noteworthy that the mode recognition is carried out based on the distinguishability of different system modes, which will be discussed in detail in the following subsection.

Mode Distinguishability Conditions
To achieve the mode recognition, it is required that any two modes of the switched system are distinguishable. In the following, the discussion on the mode distinguishability is sufficiently presented. Consider the subsystem G i , i ∈ £ of switched system (1) with the associated SKR K i . The definition of the cluster is recalled here for later use.

Definition 4 ([48]
). Given a scalar r i ∈ (0, 1), the set is called S i cluster with the cluster centre K i and cluster radius r i .
On the basis of Definition 4, the definition of mode distinguishability is established as below.

Definition 5.
We say that the modes G i , i ∈ £ of switched system (1) are distinguishable if for any K ∈ S i , there does not exist S j , j = i ∈ £ such that K ∈ S j .
Here, we are in a position to propose a sufficient theorem for the mode distinguishability. Theorem 1. Consider the SKR K i with the corresponding cluster S i , i ∈ £. K i is the cluster centre and r i is the cluster radius. If for any i = j ∈ £, there holds that then the modes of switched system (1) are distinguishable.
Proof of Theorem 1. Firstly, suppose that the system modes are not distinguishable. According to Definition 5, it holds that for some K ∈ S i , there exists mode j = i ∈ £ such that K ∈ S j . Due to K ∈ S i and K ∈ S j , the following inequalities hold and On the other hand, it is easy to get Substituting condition (5) yields which is contradictory to the inequality (7). Therefore, it can be concluded that the system modes are distinguishable, and the proof is completed.
Theorem 1 presents a sufficient condition (5) to ensure that the modes of switched system are distinguishable. As shown in condition (5), the cluster radius r i is considered to be mode dependent, which gives rise to more freedom and thus less conservatism. By setting r i = r, ∀i ∈ £, a degraded version of Theorem 1 could be derived as in the following corollary. Corollary 1. Consider the SKR K i with the corresponding cluster S i , i ∈ £. K i is the cluster centre and r is the cluster radius. If for any i = j ∈ £, there holds that then the modes of switched system (1) are distinguishable.

Mode Distinguishability Realisation
The above subsection constructs the sufficient conditions for the mode distinguishability of switched system (1). The essential issue is to ensure the K-gap metric of any two SKRs larger than the sum of their radii. Since this paper is concerned with the data-driven studies, this subsection aims to develop the data-driven realization of the K-gap metric. To this end, the normalised data-driven SKR is investigated in the first place.

Definition 6 ([49]
). If the data-driven SKR in Definition 3 satisfies K i,d,s K T i,d,s = I, then it is called the normalised data-driven SKR.
In the following, the normalised data-driven SKR is denoted asK i,d,s to avoid confusion with the general version of SKR.

Normalised Data-Driven SKR in the Open-Loop Case
The extended state space representation of subsystem G i , i ∈ £ is modelled by Clearly, Ψ ⊥ i,s is a data-driven realisation of the SKR K i,d,s . The identification of K i,d,s = Ψ ⊥ i,s is built according to the following LQ decomposition Since Performing the singular value decomposition of K i,d, As a consequence, the normalised data-driven SKRK i,d,s in the open-loop case is obtained asK

Normalised Data-Driven SKR in the Closed-Loop Case
For switched system (1), consider the feedback control system given by wherex(k) is the controller's state and w(k) is the tracking reference. Suppose that the closed-loop of the i-th subsystem is well posed and internally stabilised by A similar representation as Formula (8) can be derived as below whereΓ i,s andH i,u,s are composed of K i (z) = [Ã i ,B i ,C i ,D i ] and have the similar structure with Γ i,s and H i,u,s , respectively. For the i-th controller,X i k,1 = x(k) · · ·x(k + N − 1) and W i k,s is a Hankel matrix composed of vector w(k). By substituting Equation (13) into Equation (8), the following formula holds where T i,s = I + H i,u,sHi,u,s . Note that the well-posedness of the i-th closed-loop guarantees the invertibility of matrix T i,s . By denoting the Formula (14) can be rewritten as Similarly, by utilising the LQ decomposition and referring to [50], a data-driven SKR of G i , i ∈ £ can be derived as Then consider the singular value decomposition The normalised data-driven SKRK i,d,s in the closed-loop case is given bȳ

Data-Driven Realisation of the K-Gap Metric
Based on the obtained normalised data-driven SKRK i,d,s either in the open-loop or the closed-loop case, a theorem will be proposed to show how to realise the data-driven calculation of the K-gap metric between any two different modes. Before that, some preliminaries are restated here for the use of the deduction of the theorem.

Definition 7 ([51]
). Consider a truncation operator τ s cutting off a time signal ϑ after s + 1 sample times and is accordingly as A truncated or data-driven K-gap metric δ k d,s K i , K j (i = j ∈ £) of two subsystems G i , G j with the corresponding SKRs K i , K j is defined by The following lemma shows that the truncated result approximates to the real value of the K-gap metric as s → ∞.

Lemma 1 ([51]
). For two subsystems G i , G j (i = j ∈ £) with the corresponding SKRs K i , K j , the following formula is satisfied as s → ∞, Theorem 2. Consider two SKRs K i , K j (i = j ∈ £) with normalised data-driven SKRsK i,d,s ,K j,d,s . The data-driven realisation of the K-gap metric can be obtained by where Proof of Theorem 2. Due to the normalisation property of matricesK i,d,s ,K j,d,s , they respectively construct the orthonormal basis of the kernel spaces K i , K j . The truncated kernel spaces are given by According to Definition 7, It is obvious that with respect to β, the Equation (20) has only one minimal value in the global domain. Hence, let ∂ ∂β The solution of Equation (21) is calculated as Substituting (22) into Equation (20) gives rise to which thus implies the expression (19).

Data-Driven Fault Detection
In this subsection, the data-driven realisation of the fault detection is presented for the switched system (1). For each subsystem G i , i ∈ £, the residual evaluation function is constructed by and the threshold is set as The following Algorithm 1 is proposed to show how to determine the data-driven residual generator and the threshold for each subsystem based on the offline process data.

Algorithm 1
Offline Data-Driven Procedure Step 1: Collect the process data u i , y i of each subsystem G i , i ∈ £ Perform LQ decomposition (10) or (16) and calculate the data-driven SKR K i,d,s Step 4: Utilise the singular value decomposition to get the normalised data-driven SKRK i,d,s in (11) or (17) Step 5: Calculate the K-gap metric δ k d,s K i , K j of any two modes according to (18) and compare it with given scalar λ > 0 If δ k d,s K i , K j > λ, ∀i = j ∈ £, go to Step 6 If there exist some i = j ∈ £ such that δ k d,s K i , K j ≤ λ, return to Step 1 and update the data Step 6: Construct the data-driven residual generator according to (4) Step 7: Run the evaluation function (24) and set the threshold J i,th By virtue of the constructed residual generator in Algorithm 1, the online residual signal r i (k) and evaluation function J i (k) can be obtained with the online data. By comparing J i (k) with J i,th for each mode, the decision logic is implemented as follows.
Then the online procedure of the data-driven fault detection for switched system (1) is described in the following Algorithm 2.

Algorithm 2
Online Fault Detection Step 1: Collect the online process data u s (k), y s (k) Step 2: Run the residual generator (4) with each SKR K i,d,s , i ∈ £ Step 3: Obtain the residual signal r i (k) and the evaluation function J i (k) according to (24) Step 4: Implement the decision logic (26)

Benchmark Study
The benchmark study on a three-tank system has been demonstrated in this section, which can be regarded as the prototype for many industrial systems. As sketched in Figure 3, a basic structure of three-tank system includes three water tanks, two connecting pipes, four drain pipes and two water pumps. All the six pipes can be opened or closed by the adjustable ball valves PV 1 , PV 2 , PV 3 , LV 1 , LV 2 , LV 3 through a controller or manual adjustment. Through Pump 1 and Pump 2, water is pumped into Tank 1 and Tank 2 with the incoming mass flow rates Q 1 and Q 2 , respectively. The liquid levels h 1 , h 2 and h 3 of three-tank can be measured by the liquid level sensors with the maximum allowable water level h max . The water pump will stop working when the liquid level is higher then h max . The incoming mass flow rates of two pumps Q 1 and Q 2 and the liquid levels h 1 , h 2 and h 3 are chosen as system inputs and measured outputs, respectively.  Figure 3. Structure of the three-tank system.
In this work, the three-tank system operates around the working point h 1 = 45 cm, h 2 = 15 cm and h 3 = 30 cm. Different combinations of the adjustable ball valve's state compose the different modes of the system. Consider the three-tank system with three modes as shown in Table 1. Specifically, the mathematical model for each mode is described as follows.
For the second mode, open the valves PV 1 , PV 2 , PV 3 fully and close the valves LV 1 , LV 2 , LV 3 . The dynamics of this system mode is given by For the third mode, open the valves PV 1 , PV 3 fully, open the valves LV 1 , LV 2 by 20%, 80%, respectively and close the valves PV 2 , LV 3 . Correspondingly, the dynamics of this mode is described by The parameters of the three-tank model are listed in Table 2. With the linearisation technique, the three-tank system can be formulated in the switched system form (1) with the switching law displayed in the Figure 4. The total running time is 12,000 s and the switching of system modes occurs at 5000 s and 8000 s, respectively. The data of system input and output are collected as shown in Figure 5 with the sampling interval T s = 2 s.
Collect the offline data in the fault-free case and apply Algorithm 1 for each mode. By choosing a proper data length, the Hankel matrices are constructed, based on which the LQ decomposition is implemented and the data-driven SKR is derived. Then the normalised data-driven is calculated via the singular value decomposition. By calculating and comparing the K-gap metric, the residual generators, evaluation functions and thresholds are obtained and exhibited in Figure 6. Observing these curves, it is clear that the three modes are distinguishable. Then the online algorithm, i.e., Algorithm 2, is implemented to show the effectiveness in fault detecting. By collecting the online process data, the residual generator for each mode is presented and further, the residual signals and evaluation function values when there is no fault occurring in the three-tank system are obtained as displayed in Figure 7, from which one can see that the false alarm rate is extremely low. In other words, the designed decision logic improves the mode matching of system plant and residual.    Then consider the system with the plugging fault at 10,000 s, which is caused by closing the valve PV 1 by about 30%. Correspondingly, the fault detection result is shown in Figure 8. Moreover, a 5% offset fault in the liquid level sensor of Tank 2 at 3500 s and a leakage fault caused by opening the valve LV 3 by about 20% at 6500 s are taken into account. The fault detection results corresponding to the two cases are respectively given in Figures 9 and 10. It can be concluded from these figures that Algorithm 2 effectively detects the fault in progress and thus, the usefulness of the proposed method is demonstrated.

Conclusions
In this paper, a data-driven approach is developed for the fault detection of discretetime switched system. Considering the difficulties in acquiring the switching laws in many practical applications, this paper assumes that the switching laws are unavailable to the mode-dependent residual generators in the fault detection implementation. The unavailable switching information may lead to the mode mismatching between system plant and residual generator, for which the mode recognition is considered in this work. Firstly, sufficient criteria are constructed to ensure that the modes of the switched system are distinguishable. Then a decision logic including the mode recognition is presented for the fault detection. Furthermore, offline and online algorithms are elaborated to show the datadriven realisation of the fault detection for the underlying system. A three-tank benchmark system is studied to show the effectiveness of the methods proposed in this paper.
It is worth mentioning that the main contribution of this work is to achieve the datadriven fault detection for switched systems even without available switching laws, which is of great significance from the viewpoint of practice. Actually, the mode recognition approach proposed in this paper is effective in dealing with the analysis and synthesis problems for switched systems with unavailable switching laws and could be further applied to some other research topics of switched systems. In the future, we would like to extend our research to fault-tolerant control for switched systems based on the fault detection method of this work.