#### Abstract

A sensor fault diagnosis of an electric vehicle (EV) modeled as a Takagi-Sugeno (TS) system is proposed. The proposed TS model considers the nonlinearity of the longitudinal velocity of the vehicle and parametric variation induced by the slope of the road; these considerations allow to obtain a mathematical model that represents the vehicle for a wide range of speeds and different terrain conditions. First, a virtual sensor represented by a TS state observer is developed. Sufficient conditions are given by a set of linear matrix inequalities (LMIs) that guarantee asymptotic convergence of the TS observer. Second, the work is extended to perform fault detection and isolation based on a generalized observer scheme (GOS). Numerical simulations are presented to show the performance and applicability of the proposed method.

#### 1. Introduction

In recent years, there has been a substantial increase in the number of electric vehicles (EV), due to the increase of pollution by emissions to the environment. Recent studies show that currently there are more than 800 million cars circulating every day, which represent a distribution of 400 to 800 vehicles per 1000 inhabitants [1]. As a result, vehicles are responsible for a high percentage of global energy consumption and greenhouse gas emissions. This tendency shows an accelerated growth of vehicles per inhabitants, and, while the energy consumption in other sectors decreases, the consumption due to the continuous use of transport vehicles grows [2]. On the other hand, new sensor systems and actuators on EV are increasing in complexity, and the probability for a fault taking place is high [3].

For example, recently, a Tesla driver died in a crash while using the autopilot mode because the car’s sensor system failed to distinguish a large white 18-wheel truck and trailer crossing the highway. This accident caused a severe crisis in the EV industry. Therefore, safety, reliability, and energy-saving optimization systems are a demand of the new growing industry. In line with this demand, this work is dedicated to propose a method to detect and isolate sensor faults in an electric vehicle.

An important stage in the design of the diagnosis system is the mathematical model that represents the dynamic characteristics of the EV, which is expressed by a set of nonlinear differential equations depending on exogenous nonstationary parameters [4], for example, slopes or poor conditions of the road. However, typical models of EV consider a simplified representation given by linear models, in which it is not possible to consider these nonstationary parameters [5–7]. Nonetheless, it is possible to obtain better representations when nonstationary exogenous parameters, such as the road slope, could be measured online, such that the desired diagnosis system, which also depends on these measurable parameters, is better and less conservative [8]. In typical linear time-invariant systems, it is not possible to consider these variations. However, a viable alternative is Takagi-Sugeno models that consider nonlinearities and varying parameters as part of the mathematical modeling [9, 10], which increases the physical representativity of a real physical system.

The main advantage of a TS model is its capability of describing nonlinear dynamics through a collection of local linear models that are interpolated by nonlinear functions [11]. These functions are known as weighting functions and depend on exogenous variables that can be measurable (e.g., system inputs, outputs, exogenous nonstationary parameters, velocity, and the slope of the terrain) or unmeasurable (e.g., state variables, magnetic flux, and slip angle of the tires) [12, 13]. In this work, weighting functions are considered measurable. Additionally, an important property of this type of models is that the weighting functions are convex, which allows to extend some of the tools and methods developed for linear systems to TS systems. In particular, it has been shown that a TS dynamic model obtained through the nonlinear sector transformation approach can describe the overall behavior of a highly complex nonlinear system with a high degree of accuracy [11, 14]. As a result, its applicability in designing controllers, diagnosis systems, and observers, among others, has become of high importance; see, for instance, [15–17] and references therein. Applications on vehicles can be found in the literature; for example, in [4], a predictive control strategy using a TS model is presented to control the velocity in an EV, and the authors in [18] proposed a linear parameter varying (LPV) controller in order to control the tracking of the longitudinal velocity and the yaw velocity of the EV. In [19], a TS fuzzy model is used to represent the nonlinear behavior of an electric power steering (EPS) system, and stabilization conditions for nonlinear EPS system with both constrained and saturated control input cases are proposed in terms of linear matrix inequalities. Some works related to fault diagnosis can be consulted in the following references: in [20], an observer design strategy is presented to estimate the lateral dynamics of a vehicle and the curvature of the road. The nonlinear model of vehicle dynamics is transformed into an exact TS model with weighting functions depending on unmeasured states. In [21], a TS observer is designed to detect faults and estimate states in an induction motor, in order to implement a fault-tolerant control. Recently, in [22], an observer was designed to estimate the lateral dynamics of a motorcycle represented as a quasi-LPV system. It is important to note that, in the works reported in [4, 18, 21], the slope of the road is considered constant or close to zero; nevertheless, in real driving conditions, this parameter is not constant and has a great impact on the vehicle performance and battery consumption. Unlike previous papers, this work considers the slope of the road in order to obtain an improved sensor fault diagnosis system.

In this paper, we propose the design of an observer-based fault diagnosis for an electric vehicle. The main contributions of this paper are listed as follows: (i) a Takagi-Sugeno model is developed, whose weighting functions depend on the longitudinal velocity and the slope of the terrain in order to increase the operation range of the diagnostic system; (ii) sufficient conditions are proposed in order to guarantee the asymptotic convergence of the observer that is deduced through a quadratic Lyapunov function and a set of linear matrix inequalities (LMIs); finally, (iii) a bank of observers based on a generalized observer scheme is proposed to detect and isolate sensor faults. The combination of both techniques results in a scheme for detecting faults in the traveled-distance and speed sensors at different operating and slope conditions.

The paper is organized as follows: in Section 2, the longitudinal model of the electric vehicle is presented; in Section 3, a TS model that uses the velocity and the slope as premise variables is developed; the conditions of the designed observer for the TS model of the EV are formulated in Section 4; the numerical simulation results are presented in Section 5. Finally, conclusions and perspectives of this work are presented in Section 6.

#### 2. Nonlinear Model of the Electric Vehicle

Figure 1 shows the general scheme of an EV, which is constituted mainly by an energy source (battery bank), a power inverter, an electric motor, and a transmission system coupled to the wheels. Considering Newton’s second law and the translational equilibrium principle, the longitudinal dynamics can be represented by (see Figure 2) [2] where (kg) is the total mass of the vehicle, (m/s) is the speed of the vehicle, (N) is the traction force on the wheels, (N) is the aerodynamic force, (N) is the rolling resistance, (N) is the slope resistance due to the vehicle’s weight and the road slope, and (s) is the time.

The *traction force* is given by
where is the efficiency of the power converter, (N·m/s^{2}) is the motor constant, (A) is the motor current, (N·m) is the motor torque, (A) is the battery current, (m) is the transmission gear ratio, and (m) the radius of the wheel.

It is important to note that, for this case, the motor current is not available and the battery provides the electric current to generate all the traction power, so that the battery current is considered as the system input.

The *aerodynamic force* is given by
where (kg/m^{3}) is the air density ( /m^{3} under standard conditions), (m^{2}) is the frontal area, and (—) is the aerodynamic drag coefficient.

The *rolling resistance* is given by
where (—) is the rolling resistance coefficient and (rad) is the slope of the road that depends on the position of the EV. However, in this work, it is considered time dependent without losing generality. The coefficient of rolling friction is complex and depends on the speed of the vehicle and the conditions of the tires and the terrain.

Finally, the *gravitational force* due to the slope of the road and to the weight of the vehicle is

It is important to note that most of the reported work [4, 18, 21] consider that the vehicle is traveling on a road with a slope equal to zero or constant, which reduces the complexity of the mathematical model due to the fact that and becomes constant. Nonetheless, in real driving conditions, the vehicles have smooth and abrupt slope changes. These changes can be measured with appropriate sensors, for example, using inertial measurement units (IMUs). By considering typical linear models, it is not always possible to include the slope dynamics in the model. However, variation of this parameter makes the nonlinear system a candidate to be represented by a TS model. In this case, the slope dynamics can be included as an exogenous nonstationary parameter, which increases accuracy of the model representation with respect to the real physical system [23].

Substituting (2)–(5) into (1), the differential equation, which represents the longitudinal dynamics, is given by

For this mathematical model, the internal frictions, rotational inertias of the power train, and the inertia of the electric motor are neglected because they are small compared to the mass of the vehicle. The vehicle displacement can be computed as

Finally, the nonlinear model affine to the input is given by where is the system output. In the following section, the TS model for the nonlinear model (8) is developed.

#### 3. Takagi-Sugeno Model of the Electric Vehicle

A TS model describes a nonlinear system using a collection of local linear time invariant (LTI) models, which are interpolated by nonlinear functions known as weighting functions. The general form of a TS model is given by where , , and are the state, input, and output vectors, respectively; , , , and are known matrices of appropriated dimensions; and is the number of local models.

The weighting functions depend on , which can represent the system states, measured inputs, or an exogenous measured signal, for example, the slope of the road. The weighting functions satisfy the convex sum:

There are three methods for obtaining a TS model. When it is not possible to obtain analytical models by physical principles, the most appropriate method is system identification [24]. This method considers a structure of the TS model and its weighting functions. Then, the problem is reduced to identify the parameters of the subsystems defined as local linear models and the parameters of the activation functions using numerical optimization algorithms. However, when the analytical equations of the nonlinear system is available, a TS model can be obtained by linearizing around different selected operation points [25]. Nonetheless, the main drawback of this method is that is not easy to find such operating points, which are usually computed by heuristic methods. Finally, the most appropriate method is called *the nonlinear sector transformation* [26], which is based on the following idea: consider a simple nonlinear system , with , where the goal is to find a global sector such that ; see Figure 3(a). This approach guarantees an accurate approximation of the nonlinear system; however, it is difficult to find a global sector to enclose the nonlinear terms, and generally, a local sector is considered. This is reasonable since the variables of the physical system are always bounded. Figure 3(b) shows the local nonlinear sector, where two lines define a local sector between . The model TS represents the nonlinear system in the local region, given by .

**(a)**

**(b)**

In order to derive a TS model, the nonlinear model of the EV in (8) is represented in matrix format, as follows:

Two premise variables are considered, the nonlinear term and the slope of the road . For , a minimum velocity of 0 m/s and a maximum of 16.66 m/s (approximately 60 km/h) are considered; and for , the minimum and maximum slopes of and (−20 and 20, resp.) are considered, such that

The premise variables are selected as

The premise variables are replaced in (11), with the defined dimensions, and the premise variables are limited as follows:

These premise variables comply with (10), such that

The nonlinear model of the EV represented by the TS approach is expressed as where with

##### 3.1. Validation of the Takagi-Sugeno Model

The model parameters considered in this paper were presented in [27], whose values are displayed in Table 1. Initial conditions and an input current as shown in Figure 4 are considered to validate the TS model. The systems responses are displayed in Figure 4. As can be observed, the nonlinear system and the proposed TS model have the same behavior, and the mean square error between the two responses is , which demonstrates that the TS model represents the dynamic characteristics of the nonlinear system. In the next section, a fault diagnosis method based on a generalized observer scheme is proposed to detect and isolate sensor faults.

**(a)**

**(b)**

#### 4. Sensor Fault Diagnosis

The fault diagnosis approach proposed in this paper is based on the generalized observer scheme. This method considers a reduced order TS observer for each of the measured outputs as shown in Figure 5. For the particular case of the EV, two TS observers are considered. Both observers consider the same input (the current ), but each observer is dedicated to estimate only one output. That is, the first observer is dedicated to estimate the vehicle displacement , and the second observer the EV velocity . The main idea is to perform fault diagnosis by the evaluation of two residual signals, which are the difference between the measured and estimated outputs given by the observers.

Each observer has the following form: where is the estimated state vector, is the estimated output vector, and are the observer gain matrices to be computed. The design problem is then to find such that . Furthermore, the observer (20) needs to achieve the well-known observability conditions.

The estimation error between (20) and (17) is computed as

The error dynamics is given by

Replacing (17) and (20) in (22), the following is obtained:

From the above expression, it follows that if the state estimation (23) error converges asymptotically to zero, the estimated state vector converges asymptotically to the real state vector; then, the problem is reduced to find the matrices that satisfies condition (23). To achieve this goal, the following theorem is proposed.

Theorem 1. *The observer TS (**20**) asymptotically converges to (**17**) if there exist matrices **, **, satisfying the following matrix inequality:**The gains of the observer are determined as **.*

*Proof. *The stability conditions for the derivative of the error (23) can be obtained using the quadratic Lyapunov function and , where , whose derivative is
and replacing (23) into (25) gives
As can be observed from (26), it is sufficient that the following expression has to be negative to satisfy the Lyapunov condition:
Nonetheless, expression (27) contains nonlinear terms and . In order to eliminate these terms, it is considered that . Then by substituting this term in (27), the LMI (24) is obtained. This completes the proof.

##### 4.1. Fault Diagnosis Scheme

Note that in order to perform fault diagnosis, two observers need to be designed according to Theorem 1. Then, each observer takes the following form:

Two normalized residual signals are computed and evaluated as follows: such that if is less than a predefined threshold, then the system is working under nominal conditions; but if , then the system is working on faulty conditions. For example, if the fault occurs in sensor 1, the residual is insensitive, but changes its value. On the other hand, for a fault occurring in sensor 2, the residual remains insensitive, but changes its values (see Figure 5). This scheme produces a decoupled sensor fault detection and isolation. Nevertheless, it should be noted that it is not possible to detect simultaneous faults, which will be addressed in future contributions by considering a different diagnosis scheme.

#### 5. Simulation Results

Numerical simulation results are presented in this section in order to illustrate the applicability of the proposed method. The EV parameters are the same as the ones presented in [27], which are shown in Table 1.

Two reduced observers are considered as discussed in the previous sections, whose gains (28) were calculated by solving Theorem 1 in Python with the solver MOSEK [28].

The gains for observer 1 are

The gains for observer 2 are

In order to verify the convergence of both observers, the considered initial conditions are for the system and for the observers. For simulation purposes, variations on the slope of the road are considered as displayed in Figure 6(a). Furthermore, when the vehicle is climbing a slope, the motor requires more power, which is provided by the bank of batteries. This can be measured as an increment on the electrical current, which is displayed in Figure 6(b).

**(a)**

**(b)**

In addition, to illustrate the fault detection and isolation method, different faults are considered to affect the two sensors in different time intervals. Sensor can fail for different reasons. Usually this behavior can be observed as additive bias, for example, offsets or calibration problems. These malfunctions can be described by ramp or step functions in order to represent abrupt or slow variation faults, as described in [29, 30]. By considering the previous remark, the fault induced to the displacement sensor, denoted as , is defined in (32), and the fault induced to the velocity sensor, denoted as , is defined in (33). Both faults are displayed in Figure 7. In this simulation, two types of faults are considered: an abrupt fault in sensor 1 and an incipient fault in sensor 2, defined in (32) and (33), respectively.

The normalized residual signals are also shown in Figure 7. In both cases, the fault detection turns out to be successful. The fault identification is done by comparing the fault signature with the incident matrix given in Table 2. For example, for the fault affecting the speed sensor, the residual presents some changes at s, while the residue remains at zero. This particular signature allows to isolate the fault in the speed sensor. A similar analysis can be done for the traveled-distance sensor. The proposed fault diagnosis scheme is effective to detect faults in both sensors even in the presence of variations on the slope of the road.

#### 6. Conclusions

In this work, an observer-based fault detection system was designed for an electric vehicle. The EV is represented by a TS model whose weighting functions depend on the velocity and the slope of the road. This representation is more general compared with that of typical models, which consider a constant slope. Sufficient conditions, which guarantee the convergence of the TS observer, and the observer bank were proposed by a set of linear matrix inequalities. Finally, the detection of fault on the velocity and traveled-distance sensor was demonstrated through simulation by the variation of the residues compared to an incidence matrix. A variable slope was considered in order to increase the range of representativity of the nonlinear dynamics. The result shows that the TS fault diagnosis observer can detect and isolate sensor faults for different driving conditions and different types of faults. However, the model can be improved by measuring the mass of the vehicle in order to be considered as a premise variable. Future work will be done in order to consider simultaneous faults and inexact premise variables.

#### Conflicts of Interest

The authors declare that there is no conflicts of interest regarding the publication of this paper.