Open access peer-reviewed chapter

# PID Control for Takagi-Sugeno Fuzzy Model

Submitted: May 29th 2017Reviewed: January 23rd 2018Published: September 12th 2018

DOI: 10.5772/intechopen.74295

## Abstract

In this chapter, we deal with the problem of controlling Takagi-Sugeno (TS) fuzzy model by PID controllers using the particle swarm optimization (PSO). Therefore, a new algorithm is proposed. This algorithm relies on the use of a new objective function taking into account both the performance indices and the error signal. The advantages of this approach are discussed through simulations on a numerical example.

### Keywords

• nonlinear system
• TS fuzzy model
• PID
• self-tuning of PID controller
• PSO

## 1. T-S fuzzy model

The theory of modeling based on multiple models has evolved greatly. Indeed, several techniques have been developed in the literature. The common feature of all these modeling techniques is the decomposition of the dynamic behavior of the system into a number of operating zones. Each zone is characterized by a local linear model. Fuzzy logic based on the use of linguistic rules, heuristic strategies and the operator’s know-how. Subsequently, it has undergone a major evolution mainly in Japan where it has been applied in several industrial applications. This type of model proposed by Takagi and Sugeno (1985) makes it possible to express a nonlinear system in several locally linear subsystems. The validity of each local model is defined by a weighting function with bounded support.

The TS model is built on a set of rules of type:

• Ri: “IF premises THEN consequence”

where the premises are obtained from the linguistic propositions allowing the evaluation of the weighting functions and where the consequences corresponding to the local models.

We consider a class of nonlinear systems defined by:

yt+1=fXtE1

with the regressor vector Xtis:

Xt=[ytyt1y(tmutut1utmE2

where krepresents the discrete time, nand mdenote, respectively, the number of delayed output and the number of delayed input. The function fxtis approximated by a TS fuzzy model which is charities by consequent rules that are local linear function of the input variables [1]. The fuzzy rules of the TS model take the following general form:

Ri:ifX1isA1iandifXzisAziThenyit=Xt1θiTE3

where Ridenotes the ithIF-THEN rule, ris the number of rules, Ajij=1zis the fuzzy subset, utis the system input variable, ytis the system output, θi=ai1ai2aizbi0is the parameter vector of the corresponding local linear model. Let μiXtis the normalized membership function of the inferred fuzzy set Ai, where Ai=Πj=1zAji. The final output is calculated as the average of the outputs corresponding to the rules Ri, weighted by the normalized degree of completion (membership), according to the following expression:

ŷ=i=1rμityiE4

The membership values μithave to satisfy the following conditions:

μit01i=1,,rE5
i=1rμit=1t=1,,NE6
0<k=1Nμit<Ni=1,,rE7

Once the parameters of the premises are fixed, the parameters of the consequent for each rule can be obtained using the recursive weighted least squares technique, using the values of the membership degrees of the fuzzy partition matrix of the classification process as weights [2]:

The steps of the WRLS method are summarized in the following algorithm:

Initialize: θig0=0and Pi0=αiI.

for g=1,,ci

θigt=θigt1+Lityitxit1θigt1TE8
Lit=Pit1xit1T1/μigt+xit1Pit1xit1TE9
Pit=Pit1Litxit1Pit1E10

with k=1,,N,Pit1Mi+1×Mi+1and LitMi+1.

end for

## 2. PID control by pole placement

This section is intended to model the digital PID controller in a new form RST. The control structure RST is the establishment of three polynomials Rq1, Sq1and Tq1. According to the first section, the local linear systems can be represented by:

Yq1A(q1)=B(q1)u(q1)E11

Indeed, the vector xktakes the following form: xk=yk1yk2yknuk1ukm. This form is heard when determining PID controller parameters by the method of poles placement. Figure 1 shows the standard form of RST controller.

In this chapter, we consider only two branches Rand S, as shown in Figure 2, that is to say:

Tq1=Rq1E12

The transfer function in a closed loop is given by:

Hbf=Bq1Aq1Sq1+Bq1Rq1E13

again:

Hbf=Bq1Pq1E14

with:

ek=yrkykBq1=b1q1+b2q2Aq1=1+a1q1+a2q2Rq1=r0+r1q1+r2q2Sq1=1q11+s1q1E15

For a characteristic polynomial P1q1, the poles of the closed loop transfer function are imposed to arrive at the performances required by the follow-up of the specifications.

This problem boils down to solving the following equation:

P'q1=Aq1Sq1+Bq1Rq1E16

From the after Scheme 4, the equation of regulator is written by:

Cq1=KP1+1TI1q1+NfTdTd+NfTe1q11TdTd+NfTeq1E17

To simplify Eq. (17), we substitute:

a=TeTIE18
b=TdTd+NfTeE19

from which we obtain the following standard form:

Cq1=Kp1+a1q1+Nfb1q11bq1E20

The parameters of the digital PID regulator (r0, r1, r2and s1) are chosen according to the desired poles defined by the polynomial Pq1.

The characteristic polynomial can be in the following form:

Pq1=1+p1q1+p2q2E21

The values of p1and p2are chosen from the specifications imposed by the specifications (rise time, damping, overshoot, etc.) defined in general by comparing the behavior of the process to that of continuous system of second order.

p1=2eζwnTecoswnTe1ζ2p1=e2ζwnTeE22

where zetais a damping coefficient and wnis a pulsation. We wrote:

Pq1=Aq1Sq1+Bq1Rq1E23

By identification, we find:

b1r0+s1=p1+1a1b2r0+b1r1+a11s1=p2+a1a2b2r1+b1r2+a2a1s1=a2b2r2a2s1=0E24

The control law is:

uq1=Rq1Sq1eq1E25

From where:

uk=r0ek+r1ek1+r2ek2+1s1uk1+s1uk2E26

The structure of the corrector is the standard structure discretized by the approximation upper rectangles, and to find the values of the PID parameters will take the following expression:

Kp=r0s1r12+s1r21+s12Ti=TeKp1+s1r0+r1+r2Td=Tes12r0s1r1+r2Kp1+s13E27

## 3. PID controller based on PSO

### 3.1. PSO algorithm

Particle swarm optimization (PSO) is a stochastic technique based on collective intelligence, inspired by nature. It was developed by Kennedy and Eberhart [3]. The PSO algorithm is inspired by collective behavior in certain social animals such as fish and migratory birds. This algorithm shares many similarities with evolutionary computational techniques such as genetic algorithms. Indeed, the latter are initialized with random solutions and search for optimums by updating generations involved. However, the PSO has no evolutionary operator such as the crossing and the mutation in the image of genetic algorithms.

In the PSO, each individual of the population is called particle, while the population is known as swarm. It should be noted that a particle can benefit from the movements of other particles in the same population to adjust its position and velocity during the optimization process. Each individual uses local information to which he can access the movement of his nearest neighbors to decide his own move. Very simple rules like “staying close to other people,” “going in the same direction” and “going at the same speed” are enough to maintain the cohesion of the whole group. At each displacement, the performance of each particle is measured by its position and velocity by minimizing a performance function called fitness [4].

The PSO’s basic algorithm works on a population called a swarm of possible solutions, which are called particles. These particles are placed randomly in the search space of the objective function. At each iteration, the particles move, taking into account their best position (selfish displacement) but also the best position of its vicinity. In fact, the new speed is calculated from the following formula [3]:

Vidt+1=wVidt+c1r1pidtxidt+c2r2pgdtxidtE28

In this equality, tis the number of iteration, Vidtand xidtstand for separately the speed of the particle iat its ttimes and the d-dimension quantity of its position, c1and c2are the acceleration coefficients, r1and r2are two random numbers drawn uniformly in 01. pidand pgdare, respectively, the best position reached and the best position of the vicinity reached of the particle iand wis an inertial coefficient defined by:

w=wmaxwmaxwminitermaxiterE29

where itermaxis the maximum of iteration in evolution process, wminand wmaxare the minimum and maximum values of w, respectively, and iteris the current value of iteration. The position of the particle can then be determined by the speed that we have just calculated:

xid=xid+VidE30

We generate Vid0and xid0at the beginning of our algorithm. The PSO algorithm stops if one of these convergence criteria is reached:

• the maximum number of iterations tmaxis reached;

• the speed variation tends to zero; and

• the fitness function is satisfied.

### 3.2. Tuning of PID using PSO optimization

The PSO optimization module complete the self-tuning of PID parameters with a microprocessor that achieves the optimum of PID parameters. These parameters are used to retune the PID controller in PID controller module. To seek the optimum parameters kp,kiand kdof PID controller, PSO program should search in D-dimensional search space. The function optimization problem can be viewed as a 3-dimensional space in this chapter. That is, tuning of PID controller parameters is to search optimization value in kp, kiand kd, the 3-dimensionsal search spaces. With the optimized parameters based on PSO algorithm, the PID controller can achieve the optimal properties, that is, a fast system with a minimum of overrun, there is a compromise between performance and minimum energy [5].

In most cases, PID controller work with an error signal (e) that is calculated from the process variable (y) and setpoint (yr). The error represents the deviation of the process variable from the setpoint. Then, the error signal is described as:

et=yrtytE31

A PID controller optimized with PSO algorithm was developed for a TS Fuzzy system. It was also called the PSO-PID controller. PSO algorithm is mainly utilized to determine three optimal PID gains.

Adjusting the parameters of a PID controller can be considered as an optimization problem where it is a matter of finding the optimal solution of the gains of the controller in a predefined search space in order to allow the system to have certain desired performances. In this context, the PSO algorithm can be applied to find the optimal combination of the proportional, integral and derivative gains of the PID controller. During the application of the PSO, the initial population will be created randomly with Np individuals containing three decision variables: kp, kiand kd. To evaluate the individuals, we inject these gains into the PID controller and measure the parameters of the corresponding system output using the parameters of the TS model. The choice of the cost function is determined by the objective to be achieved. These objectives are determined by the performance defined in the specifications. Typically, this is static error, rise time, stabilization time and maximum allowed exceedance.

In the literature, we can find a multitude of performance indices. Most of these indices are based on the optimization error. The integrated square error (ISE) is given by:

J=0e2tdtE32

Another fitness function is integrated time weight square error (ITSE), which is given as follows:

J=0te2tdtE33

It seems simpler, yet it is hard to get the ideal time response too. Another widely used fitness function is:

J=0w1et+w2u2tdtE34

where etand utrepresent, respectively, the system error and the output of controller, the utilization of this second item is to limited energy (Figure 3).

Since, more than the error signal, the performance indices in the time domain are also the overshoot (D%), steady-state error (Ess) the settling time (Ts) and the rise time (Tr). The performance criteria must include all these performances. Therefore, we proposed a new objective function and it is described by the following equation:

J=1expβD%+Ess+expβTsTr×0te2tdtE35

The framework of online parameter self-tuning for nonlinear system based on TS Fuzzy model is depicted in Figure 3.

## 4. Simulation results

This section presents a simulation example to show an application of the proposed control algorithm and its satisfactory performance.

The nonlinear system is characterized by this equation [6]:

yk=a1sinyk1+a2yk2+a3uk2yk3+b1uk1+b2tanh0.7uk32E36

with a1=0.4; a2=0.3; a3=0.1; b1=0.6; and b2=1.8. Here, ykis the output and ukis the input which is uniformly bounded in the region 22.

We choose yk1yk2uk1uk2as inputs variables, and the number of fuzzy rules is four. The setup applied in this work was the following: the population size was 20, the stopping criterion was 30 generations, wmin=0.5, wmax=0.9and c1=c2=2.

We simulated two experimental cases. In case 1, the simulation result of the control pole placement for the nonlinear system is shown in Figure 4.

It can be seen from Figure 4, we note that the output of command has an important overshooting. In case 2, the PSO algorithm is adding to PID control. Figure 5 shows simulation results of the output signal of the control system.

We make a comparative study of PID control by pole placement method and the optimization algorithm of PSO (Table 1).

Pole placement methodOptimization of PSO
D%6415
Tss13.5688.568
Trs108

### Table 1.

Result of PID parameters and PID-PSO.

We note though, the advantage of optimizing the parameters of PID controller by PSO compared with the method of pole placement quality control, we observed that the overshoot decreases and the algorithm converges in minimum time.

## 5. Conclusion

We studied the PID control of a nonlinear system of Takagi-Sugeno for a square input signal using pole placement technique. With this method, we obtain results with an important overshooting. To solve this problem, we have compiled the PID control algorithm with PSO optimization algorithm that it has given good results.

chapter PDF
Citations in RIS format
Citations in bibtex format

## More

© 2018 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution 3.0 License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

## How to cite and reference

### Cite this chapter Copy to clipboard

Taieb Adel and Chaari Abdelkader (September 12th 2018). PID Control for Takagi-Sugeno Fuzzy Model, PID Control for Industrial Processes, Mohammad Shamsuzzoha, IntechOpen, DOI: 10.5772/intechopen.74295. Available from:

### Related Content

Next chapter

#### Distillation Column

By Nasser Mohamed Ramli

First chapter

#### Wavelet PID and Wavenet PID: Theory and Applications

By José Alberto Cruz Tolentino, Alejandro Jarillo Silva, Luis Enrique Ramos Velasco and Omar Arturo Domínguez Ramírez

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.