# Fuzzy Modeling and Control for a Class of Inverted Pendulum System

Authors: Liang Zhang; Xiaoheng Chang; Hamid Reza Karimi
Journal: Abstract and Applied Analysis
 (2014)

---

## Abstract

Focusing on the issue of nonlinear stability control system about the single-stage inverted pendulum, the T-S fuzzy model is employed. Firstly, linear approximation method would be applied into fuzzy model for the single-stage inverted pendulum. At the same time, for some nonlinear terms which could not be dealt with via linear approximation method, this paper will adopt fan range method into fuzzy model. After the T-S fuzzy model, the PDC technology is utilized to design the fuzzy controller secondly. Numerical simulation results, obtained by Matlab, demonstrate the well-controlled effectiveness based on the proposed method for the model of T-S fuzzy system and fuzzy controller.


---

## Body

## 1. Introduction

Traditional control theory has perfect control ability for explicitly controlled system, however, which is a little weak to describe too complex or difficult system accurately. Therefore, many researchers seek ways to resolve this problem; those researchers have also focused on fuzzy mathematics and applied it to control problems. Zadeh [1] created fuzzy mathematics on an uncertainty system of control which is great contribution. Since the 70s, some practical controllers appear in succession, so that we have a big step forward in the control field. A number of control design approaches using adaptive control [2–4], sliding mode control [5, 6], H∞ [7–9], optimal control [10–12], control based data driven [10, 13–15], and fuzzy control [16, 17]. The inverted pendulum system is controlled by the method of fuzzy control and realizes steady control. The inverted pendulum is a typical automatic control in the field of controlled object [18], which is multivariable and nonlinear and strong coupling characteristics, and so on. The inverted pendulum system reveals a natural unstable object, which can accomplish the stability and good performance by the control methods.For the stability control of inverted pendulum system, the establishment of the model takes an important role. T-S fuzzy control [19] is the most popular one of the most promising methods based on modeling of fuzzy control research platform. At present, the T-S fuzzy control is one of the methods for nonlinear system control research [20], which is very popular. Based on T-S fuzzy model of inverted pendulum system modeling and control have a certain research. For inverted pendulum system based on T-S fuzzy mode, there are two methods [21]: the first one is the fan of nonlinear method. Although this method has high precision in describing the nonlinear system, it obtains many fuzzy rules. Thus it brings to the controller design difficulty, especially for the nonlinear term system. The second one is linear approximation modeling method, the method at the expense of the modeling accuracy and less number of rules of T-S fuzzy model. Since the second method can obtain a simple T-S fuzzy model, so in the inverted pendulum system modeling it is widely applied, but there is a very important problem, which is that if for one type of inverted pendulum system it contains the approximate method to deal with the nonlinear term, then the fuzzy modeling becomes the key to study.Based on the above analysis and discussion, this thesis will carry the fuzzy modeling and control on inverted pendulum system of complex nonlinear term. For this point, sector nonlinear and linear approximation method will be adopted in the T-S fuzzy modeling of some inverted pendulums and the design of fuzzy controller. The fuzzy modeling and control method can achieve the stability control of the single inverted pendulum system through the simulation.


## 2. Fuzzy Modeling for the Inverted Pendulum System

Assume that the car’s quality isM, the pendulum’s quality is m, the pendulum’s length is l, the pendulum’s angle is θ at an instant (the angle between the pendulum rod and the vertical direction), the initial displacement is x, g=9.8 m/s2 is the gravity constant, the level for control is forced acting on the car is F, a=1/(m+M), and the inverted pendulum’s state space is as follows:(1)(x˙1(t)x˙2(t))=(x2(t)1(4l/3)-amlcos⁡2(x1(t))[gsin(x1(t))-amlx22(t)sin2(x1(t))2-x2(t)-au(t)]),where θ is x1(t), θ˙ is x2(t), F=u(t), and x1(t)∈(0,±π/2), x2(t)∈[-α,α].Whenx1(t)=±π/2, the system is uncontrollable, so we take x1(t)∈[-88°,88°] as the range. For this inverted pendulum system, T-S fuzzy model can be considered as follows:
(2)Ri:ifx1(t)isM1i,…xn(t)isMnithenx˙(t)=Aix(t)+Biu(t),
where x(t)=[x1(t)x2(t)⋯xn(t)]T∈Rn is the state variables for the fuzzy system, Mki is the fuzzy sets and where k=1,2,…,n, i=1,2,…,r, the input vector is u(t)∈Rm, Ai∈Rn×n, Bi∈Rn×m are coefficient matrix for the system. The number of fuzzy rules for the system is r.The total fuzzy control system is as follows:(3)x˙(t)=∑i=1rωi(x(t))(Aix(t)+Biu(t))∑i=1rωi(x(t)),
where ωi(x(t))=∏k=1nMki(xk(t)), and Mki(xk(t)) is denotes the membership degree, and where xk(t) for Mki. The hi(x(t))=ωi(x(t))/∑j=1rωj(x(t)) and (2) will be as follows:
(4)x˙(t)=∑i=1rhi(x(t))(Aix(t)+Biu(t)),
where hi(x(t))≥0 and ∑i=1rhi(x(t))=1.There is an important nonlinear term in this inverted pendulum system, in other wordsx22(t)sin2(x1(t)), which should be paid more attention. The nonlinear term cannot be conducted through the linear approximation method on this inverted pendulum system. Thus, the thesis will combine the linear approximation method with the fan of nonlinear method to establish the fuzzy model. The process is as follows.(1)
Ifx1(t) is about 0, through approximate treatment the system with the linear approximation method, the fuzzy model of system can be obtained as follows:then
(5)(x˙1(t)x˙2(t))=(01g(4l/3)-aml-1(4l/3)-aml)(x1(t)x2(t))+(0-a(4l/3)-aml)u(t)(x˙1(t)x˙2(t))=(013g4l-3aml-34l-3aml)(x1(t)x2(t))+(0-3a4l-3aml)u(t).(2)
Ifx1(t) is about ±π/2, and consider the fan of nonlinear method, and z(t)=x2(t)sin2(x1(t)),then(6)max⁡x1(t),x2(t)z(t)=x2(t)sin2(x1(t))≡c1=0.2595.Then(7)min⁡x1(t),x2(t)z(t)=x2(t)sin2(x1(t))≡c2=-0.2595.
(1)
Ifz(t) is c1, through the linear approximation method and the fan of nonlinear method to approximate treatment, the fuzzy model of system can be obtained as follows:
(8)(x˙1(t)x˙2(t))=(01g(2/π)4l/3-(14l/3amlc12+14l/3))(x1(t)x2(t))+(0-a4l/3)u(t),(x˙1(t)x˙2(t))=(013g2πl-(3amc18+34l))(x1(t)x2(t))+(0-3a4l)u(t).(2)
Ifz(t) is c2, through the linear approximation method and the fan of nonlinear method to approximate treatment, the fuzzy model of system can be obtained as follows:
(9)(x˙1(t)x˙2(t))=(01g(2/π)4l/3-(14l/3amlc22+14l/3))(x1(t)x2(t))+(0-a4l/3)u(t),(x˙1(t)x˙2(t))=(013g2πl-(3amc28+34l))(x1(t)x2(t))+(0-3a4l)u(t).Here define membership functions. For the part of linear approximation, the membership function is shown as Figure 1.Figure 1
Membership functions of two-rule model.Rule 1: Consider(10)H1(t)={2πx1(t)+1,(-π2≤x1(t)≤0)-2πx1(t)+1,(0<x1(t)≤π2).Rule 2: Consider(11)H2(t)=1-H1(t).
Figure 2 is the membership function for the fan of nonlinear method. z(t) can be rewritten as z(t)=∑i=12Ei(z(t))ci, where E1(z(t))=(z(t)-c2)/(c1-c2) and E2(z(t))=(c1-z(t))/(c1-c2). The membership functions E1(z(t)) and E2(z(t)) will meet the equation E1(z(t))+E2(z(t))=1.Figure 2
Membership function for the fan of nonlinear method.In conclusion, the finally fuzzy model for the system will be shown as follows.Rule 1: ifx1(t) tends to 0, then x˙(t)=A1x(t)+B1u(t).Rule 2: ifx1(t) tends to ±(π/2)(|x1(t)|<π/2) and z(t) takes the maximum value, then x˙(t)=A2x(t)+B2u(t).Rule 3: ifx1(t) tends to ±(π/2)(|x1(t)|<π/2) and z(t) takes the minimum value, then x˙(t)=A3x(t)+B3u(t).The function and value of every parameter are shown in Table1.Table 1
Function parameters.
Parameter
Function
Value
M
The mass of the cart
1.096 kg
m
The mass of the pendulum
0.109 kg
l
The length of the pendulum
0.25 m
θ
The angle of the pendulum from the vertical
F
The force applied to the cartAll the parameters defined in Table1 are taken to account, then the system coefficient matrix can be obtained as follow
(12)A1=(013g4l-3aml-34l-3aml)=(0131.5397-3.2183),B1=(0-3a4l-3aml)=(0-2.6708),A2=(013g2πl-(3amc18+34l))=(0118.7166-3.0088),B2=(0-3a4l)=(0-2.4896),A3=(01g(2/π)4l/3-(14l/3amlc22+14l/3))=(0118.7166-2.9912),B3=(0-a4l/3)=(0-2.4896).
The model rules can be represented as follows:
(13)h1(t)=H1(t),h2(t)=H2(t)×E1(z(t))=H2(t)×[z(t)-c2c1-c2],h3(t)=H2(t)×E2(z(t))=H2(t)×[c1-z(t)c1-c2].
For the T-S model of the control object, a parallel distributed compensation control scheme (PDC) is employed. And the regulations are described as follow:
(14)Ri:ifx1(t)isM1i,…xn(t)isMnithenu(t)=Kix(t).
Here the fuzzy controller and the fuzzy system adopt the same fuzzy rule. The overall model for the fuzzy controller is as follows:
(15)u(t)=∑i=1rhi(x(t))Kix(t).
The closed control system can be obtained by combining (2) and (4):
(16)x˙=∑i=1r∑j=1rhihj(Ai+BiKj)x.


## 3. Based on Linear Matrix Inequalities (LMI) and the Matlab Simulation

Without the controller, the simulation output curves of the angular velocity and angular acceleration are shown in Figure3.Figure 3
Simulation result without the controller.Figure3 shows that the inverted pendulum system is unstable without the controller.In the following, by using the linear matrix inequalities technique [23], the fuzzy controller is designed.Let us define the Lyapunov function as(x(t))=xT(t)Px(t), P>0, then the stable criterion of the system for (16) is as follows:
(17)∑i=1r∑j=1rhihj(Ai+BiKj)TP+P∑i=1r∑j=1rhihj(Ai+BiKj)<0.
Define Q=P-1; we can obtain (18) by multiplying Q on both sides contemporary:
(18)Q∑i=1r∑j=1rhihj(Ai+BiKj)T+∑i=1r∑j=1rhihj(Ai+BiKj)Q<0.
After defining KjQ=Nj, the system stability discriminant conditions can be obtained. And this will guarantee a positive definite matrix Q and matrix Nj can be searched, then the following matrix inequality can be established:
(19)QAiT+NiTBiT+AiQ+BiNi<0,QAiT+NjTBiT+AiQ+BiNj+QAjT+NiTBjT+AjQ+BjNi<0,cccccccccccccccccccccccccccccccccccccccccccccccci=1,2,…,r,i<j,
where the stable controller will be obtained from (20):
(20)Kj=NjQ-1.
Through solving (19) by linear matrix inequality with LMI of Matlab [24], we can obtain
(21)Q=[1.1127-0.4874-0.48741.9975],N1=[14.6725-7.9846],N2=[9.7868-5.9077],N3=[9.7836-5.8945].
Moreover, taking advantage of (20), the fuzzy controller gain will be obtained and shown as follows:
(22)K1=[12.8038-0.8733],K2=[8.3975-0.9086],K3=[8.3975-0.9020].Put the controller gain into (16); design the simulation program in the simulink environment. Here the initial value x(0)=[-0.01-0.1] is selected. The results of the fuzzy control simulation of the level single inverted pendulum system are shown in Figures 4, 5, and 6.Figure 4
Simulation result of the angle.Figure 5
Simulation result of the angular velocity.Figure 6
Simulation result of the controller.Simulation results show that the system responses converge to the equilibrium point, which indicates that the design of the controller is stable.


## 4. Conclusion

This thesis takes a class of an inverted pendulum system as the research object. The system fuzzy model was established by the methods that combining with the linearization approximation processing and fan-shaped interval, and then the fuzzy controller was designed. Matlab-Simulink software toolbox was employed to be on computer simulation. The results show that it achieved a stable control of the single-stage inverted pendulum system through fuzzy control method on the basis of this fuzzy model. This model has the advantages of less fuzzy rules, high precision, and simple structure. The research results can provide an effective way for the subsequent instability in other nonlinear system modeling and fuzzy control.



---

*Source: 936868-2014-01-29.xml*