METHODOLOGY FOR MONITORING AND DIAGNOSING FAULTS OF HYBRID DYNAMIC SYSTEMS: A CASE STUDY ON A DESALINATION PLANT

The imperative of quality and productivity has increased the complexity of technological processes, posing the problem of reliability. Today, fault diagnosis remains a very important task because of its essential role in improving reliability, but also in minimizing the harmful consequences that can be catastrophic for the safety of equipment and people. Indeed, an effective diagnosis not only improves reliability, but also reduces maintenance costs. Systems in which dynamic behaviour evolves as a function of the interaction between continuous dynamics and discrete dynamics, present in the system, are called hybrid systems. The goal is to develop monitoring and diagnostic procedures to the highest level of control to ensure safety, reliability and availability objectives. This article presents an approach to the diagnosis of hybrid systems using hybrid automata and neural-fuzzy system. The use of the neural-fuzzy system allows modeling the continuous behaviour of the system. On the other hand, the hybrid automata gives a perfect estimate of the discrete events and make it possible to execute a fault detection algorithm mainly consists of classifying the appeared defects. On the implementation plan, the results were applied in a water desalination plant.


INTRODUCTION
The complexity of modern systems causes an interaction between the continuous and discrete behaviour of systems.This is the case for several manufacturing plants, robotics, agents systems, and physical plants.This kind of complex systems, called hybrid dynamic system (HDS), requires a specific formalism to be analysed and modelled.In the literature, a number of modeling formalism of HDS has been proposed.It can be classified into three main categories: continuous approach, eventbased approach, and mixed approach.Continuous approaches ignore the discrete mode changes of this system whereas discrete approaches disregard the continuous dynamics of the system.In mixed approaches, continuous and discrete components are represented rigorously and explicitly and the collaboration is reflected in the interface they connect.
HDS fault diagnosis requires the implementation of a monitoring system capable, at any time, of managing a failure affecting the system.That's why, the choice of modeling approach is very important to ensure system reliability and security.Recently, different techniques have been applied.In this paper, we focus our attention on the problem of FDI (Fault Detection and Isolation) for hybrid system.We have proposed a diagnoser based on the use of neural/fuzzy system well known in continuous field, coupled with hybrid automata used in the field of discrete event systems.A hybrid automaton is used also as well for the detection and location of faults.Indeed, if the diagnosis is fast and the faulty component is identified, the maintenance operations can be performed more quickly.
In order to present our methodology, this paper is organized as follows: After an introduction on the context of this work, the section 2 describes the different steps of the proposed fault diagnosis approach, also the modeling and fault detection technique used.Section 3 is dedicated to the description of Reverse Osmosis Desalination system.This system is considered to show the effectiveness of our diagnosis approach.At the end, a conclusion is presented with some perspectives.

FAULT DIAGNOSIS APPROACH BASED ON HYBRID MODEL
First, Fault diagnosis is very important because it can provide accurate fault information and defined the diagnosability of the system .The diagnosability consists in determining if the system model is rich enough in information in order to allow the diagnose to infer the occurrence of predefined faults within a finite observable events after their occurrence.In this paper focus on hybrid models and propose the generation of a diagnoser from a Neuro-fuzzy model and hybrid automata model of the system.
The mixed approach, proposed in this paper, is based on a combination of two parts: continuous model and discrete model.A group of ANFIS models describe the continuous part and the discrete component is described by a hybrid automata.This approach operates by alternating continuous steps where the state variables and time operate continuously and discrete steps of a plurality of discrete and instantaneous transitions may be crossed.
This method of diagnostic combines the advantages of both approaches ANFIS and hybrid Automata for optimal performance especially during the fault localization phase.Each step is described in a conventional form.

Fault diagnosis approach
The Neural/fuzzy modeling goal remains to design a model for the generation of residues.The general concept of residue generation also remains the same as for analytical models.It consists in comparing the outputs of the process to their estimates, but in this case, the estimates are calculated by an ANFIS model.
The output residual of a dynamic model can be calculated by: The sum of square residual can be calculated as: Where, N is the length of the observation.Assume that the threshold value ε, then the fault can be determined by: And ε=2J0, where J0 is the sum of square residual under normal condition.

Modeling of the continuous part based on ANFIS
Real systems are complex and generally non stationary behavior and nonlinear making a modeling step more difficult.Yet implementing a predictive tool must accommodate this.Also divers artificial intelligence techniques were tested on prediction problems and have shown better performance than those of "conventional" methods It is clear from this work that the neuro fuzzy networks are particularly suitable In this set our work deals more specifically with the ANFIS (Adaptive Neuro Fuzzy Inference System) proposed by Jang [2].

Adaptive Neuro-Fuzzy Inference System (ANFIS)
We present in this section the basics of the ANFIS network architecture and its hybrid learning rule.The joint use of neural and fuzzy methods in hybrid models provides benefits, mainly, learning capabilities of neural networks, and the readability and flexibility of fuzzy logic.
The main type of association between neural networks and fuzzy systems is the case where a fuzzy inference system is put in the form of a multilayer network, wherein the weights correspond to the parameters of the system, the network architecture depending on the type of rules and the methods of inference, aggregation and defuzzification chosen.The most used in this field is the ANFIS model.The ANFIS is an adaptive array class.It can be seen as a feed-forward neural network for which each layer is a component of a neuro-fuzzy system and, as such, it is an "approximator" universal.It is thus used in various applications of predictions.ANFIS system performs a linear approximation of the output variable by decomposing the input space into different fuzzy spaces.
Consider Figure 1 to describe the architecture of a system ANFIS and briefly explain the inference mechanism of such a system.Adaptive neuro-fuzzy inference system is a type of hybrid system that combines the evident knowledge of Takagi-Sugeno (TS) fuzzy inference system and the supervised learning potential of the multilayer feedforward neural network in one approach called ANFIS.It is a very robust technique that aims to achieve the nonlinear and complex relationship between input and output data, it is much simpler, suppose that we have two inputs x and y, and one output f. for "If-Then" of Takagi-Sugeno (TS) model, two rules are used as follows ( 4) and ( 5): Where A1, A2, and B1, B2 are the membership functions of the two input x and y respectively and the p1, q1, r1 and p2, q2, r2 are linear parameters of the output of Takagi-Sugeno fuzzy inference model.
As standard, ANFIS architecture has five layers.Where the first and fourth layers (square nodes) formed from an adaptive node, and fixed nodes (circle nodes) constitute the essential ingredient of the other layers.Explanation of each layer is described in the following paragraphs: The output of the nodes in Layer 1 is the membership values of the premise part: Every node in Layer 2 is a fixed node labeled M, which multiplies the incoming signals: Every node in Layer 3 is fixed node labeled N for normalization.It calculates the ration of the i-th rules firing strength to the sum of all rules firing strengths: In Layer 4, every node is an adaptive node while the node function is: Where wi is the output of layer 3 and pi, qi, ri are the parameters for the first order Sugeno rule.The overall output of the network can be defined as: The gradient descent algorithm combined with the least squares method to from hybrid learning algorithm proposed by Jang [2], used to learn the ANFIS algorithm or to update the nonlinear premises parameters in layer 1 and the linear consequent parameters in layer 4. Forward path and backward path are the two ways of the hybrid learning algorithm.Firstly, on the forward path, the premises parameters in layer 1 are fixed and a recursive least square estimator (RLSE) method was applied to update the consequent parameters in the layer 4. The linearity of the consequent parameters is the reason to use the RSLE method which aims to accelerate the convergence rate in hybrid learning process.While the algorithm is in the backward way the consequent parameters are fixed and the gradient descent algorithm runs to update the premises parameter in the layer 1, and an error generated that represents the difference between the desired output and the actual output, is propagated back to the first layer.

Modeling of the discrete event by hybrid automata
Systems where discrete and continuous dynamic interact and where their interaction determines the qualitative and quantitative behavior of these systems are known as hybrid dynamic systems (HDS).These systems can be of very diverse natures.We can meet continuous systems which are associated discrete commutations or discrete event systems which are associated certain continuous evolutions.An overview of the main approaches proposed in the literature relating to the modeling of hybrid systems, can be found in [4].
A hybrid automaton is a mathematical model for HDS, which combines, in the same formalism, transitions allowing to capture a discrete change with differential equations allowing to capture a continuous change.

Hybrid automata
From an informal point of view, a hybrid automaton appears as a finite state automaton driving a set of continuous dynamic equations.The equations, modeling the continuous behavior at a given moment, depend on the state of the automaton but this one evolves according to the value of the continuous quantities.A hybrid automaton is defined by the tuple:  = (, , , , , ) (11) where, Q: is the set of hybrid model states of the system; Σ: is the set of system events; X: is a finite set of continuous variables describing the continuous dynamics of the system; flux: Q × X → <n: is a function characterizing the continuous dynamic evolution of X in each state q; δ: Q × Σ → Q: is the state transition function of the system.A transition δ(q, e) = q+ corresponds to a change from state q to state q+ after the occurrence of discrete event e ∈ Σ; Init = (q1 ∈ Q, X(q1), flux(q1)): is the set of initial conditions [3].
Using Hybrid automata requires the creation of a normal operating model that represents the system in normal situations, that is, in the absence of any fault.This model is obtained from the identification of different possible states of the system, the evolution equations in each state and the conditions necessary for transitions from one state to another.
In this section of paper, the hybrid automata have been used for modeling to estimate the current mode of hybrid system.

Fault diagnosis through the hybrid automata
The goal is to design a diagnoser to analyze, detect, and locate a fault in a system.The method used is based on the use of hybrid automata, a tool for modeling and monitoring real-

REVERSE OSMOSIS DESALINATION SYSTEM DESCRIPTION
The treatment plant concerned by this study is the drinking water production station of the city of Touggourt in southeast Algeria.It supplies water to over 200,000 inhabitants and has a nominal treatment capacity of 400 l/s.The plant operates continuously (24 hours a day) and includes three reverse osmosis streams that operate independently.A reverse osmosis system typically consists of four main components: pre-treatment, high pressure pump, RO unit, and post-treatment.
The city of Touggourt is at present fed with drinking water from four geothermal drillings of 1700 m of depth.The daily flow of the station is 34560 m 3 /day.The salinity of water equal to 2.5 g/l and the temperature exceeds 60°C.The desalination plant can treat (507 m 3 /h) to produce (450 m 3 /h) treated water having a salinity of less than 0.6 g/l.The conversion rate over than 80%.At first, it's pretreated to prevent clogging membranes.
The filtration of the suspended material is done through 4 cylindrical pressure sand filters working in parallel.Each osmosis stream has 4 cartridge filters.The step of the pretreatment of raw water before it passes through the reverse osmosis modules is necessary to give the raw water physicochemical characteristics compatible with the type of membrane used, and in this way prolong its service life.
Due to the high pressure, osmosis water penetrates through the membranes and the salt water becomes highly concentrated (brine).The product of the water flows directly from the permeators into a storage tank, where blinding water and chemicals are added to the mineralized water to adjust pH and conductivity.Brine (at high pressure) is removed (Fig. 3).

Simplified modeling
This section describes a simplified model of the desalination plant, which is used for modeling and fault diagnosis procedure.Figure 4 shows the flow diagram of the desalination plant and the main variables of the system.Q1 is the raw water flow stocked in the raw water tank, Q2 is the feed water flow provided by the feed pump 'P1', Q3 is the permeate flow provided by the high pressure pump 'P3', Q4 is the reject flow, Q5 is the blending water, Q6 is the drain water provided by the reject pump 'P6' and Q7 is the water demand provided by the treated water pump 'P7'.The water level of the tanks may be calculated by a mass balance of the water in each tank, as follows: Where, hi is the water level of the tank i, Si is the cross section of each tank, Ei the pump state (ON=1; OFF=0).

Functioning mode of the system
The desalination plant functioning can be summarized in four modes.
• Mode 1 (Filling): In this mode, tanks T1, T2 and T3 have to be filled to h1max, h2max and h3max respectively.• Mode 2 (Filling + Drain): Tanks T1 and T2 have to be filled to h1max, and h2max respectively and Tank T3 has to be emptied to h3min.• Mode 3 (Filling + Drain + Transferring): Tank T1 has to be filled to h1max, Tank T3 has to be emptied to h3min and Tank T2 has to be filled/emptied to h2max/h2min depending the transferred flow Q5.
• Mode 4 (Filling + Transferring): Tank T1 has to be filled to h1max and Tank T2 has to be filled/emptied to h2max/h2min depending to the transferred flow Q7.

Continuous part modeling
The desalination plant modeling is performed by choosing eight input-output variables; these models allow approaching the behavior of this system by a collection of local models.They have a very important representative capacity.Indeed, the number of necessary rules to approach a system to a certain degree of accuracy is generally reduced: ℎ ̂2 =  2 ( 3 ,  5 ,  7 , ℎ 2 ) (16) For each studied desalination plant variable, a series of data were used for its identification obtained from operating measurements data of the studied plant.For example, for water tank T1 level flow variable, the network ANFIS model used is composed of three inputs and one output, and each input is fuzzified by three fuzzy sets of Gaussian type.

Discrete part modeling
The figure 6 shows the hybrid automaton that represents the system under normal conditions in this exploitation mode is part of the complete automaton.

Construction of the diagnoser with stateflow
The control of the desalination plant is simulated with the MATLAB Stateflow and Simulink toolboxes.It uses a variant of the finite state machine.It specifically uses the formalism of hybrid State charts and provides a building block that can be included in a Simulink model.Moreover, it allows the representation of hierarchy, parallelism and history.The hierarchy allows the organization of complex systems by defining a parent / offspring object structure.

Residuals generation
The generation of residues consists in comparing the measurements resulting from the system with their estimates resulting from a neuro-fuzzy model.With this model we can generate 5 residuals: 3 continuous residuals and 2 signature events residuals.

Simulation results
In order to test the effectiveness of the faults detection and location technique of the proposed diagnosis approach, we injected defects in a random way.At first, the system is infected with 6 faults as mentioned in table 1 and each fault can be either continuous or discrete fault.The Figure 8 presents the generated residual and decision for each fault.After several simulations, this diagnosis approach detects and locates every defect at any time, it is thus reliable.Also the faults are always detected and isolated most quickly possible.The results presented in work show the effectiveness of the proposed diagnostic system.

CONCLUSION
In this paper, we have presented an approach to solving the fault detection, isolation and identification problem for hybrid systems.The proposed diagnosis system is used for detecting faults in desalination plant.We used these models for three steps ANFIS system is well suited for designing intelligent controllers because it is capable of making inference ever uncertainty with a learning capacity of neural networks.The simulation results show the efficiency of the proposed scheme for automatic fault diagnosis.The advantage of the proposed approach is the simplicity and the efficiency for industrial applications.
Future works aims at considering the problem of fault tolerant control using the proposed scheme.

Fig. 2 .
Fig. 2. Diagnosis system based on the proposed model.
0  ℎ       (23) We injected defects in a random way.We consider two kinds of failure mode: -Continuous faults: faults that perturb the state equations.-Discrete faults: faults that perturb the transition between different modes.

Table 2 .
Faults to be detected and isolated