Fuzzy Logic Control of Ball and Beam System M ... - MAFIADOC.COM

0 downloads 0 Views 1MB Size Report
designing the challenging Non-linear control systems as it provides a ... presents the design and analysis of a FLC for the outer loop and a PD controller for the.
2010 2nd International Conforence on Education Technology and Computer (ICETC)

Fuzzy Logic Control of Ball and Beam System

Z.Shareef

M. Amjad, KashifM.I., S.S Abdullah,

Pakistan Institute of Engineering and Applied Sciences (PlEAS). Rawalpindi, Pakistan

Faculty of Electrical Engineering, Universiti Teknologi Malaysia. Skudai, Johor Bahru, Malaysia.

zeeshan [email protected]

[email protected], [email protected]

Abstract-Fuzzy alternative designing provides

to the

a

logic

(FLC)

controller

existing

classical

challenging

heuristically

or

Non-linear method

by

is

modern control If-Then

an

attractive

controllers systems Rules

as

for it

which

resembles human intelligence. This paper presents the design and analysis of a FLC for the outer loop and a PD controller for the inner loop of a ball and beam system. Additionally, a classical PID controller based on ITAE equations for the beam position is also designed to compare the performance of both types of controllers.

Results reveal that

FLC found to give better

transient and steady state results compare to classical PID. Keywords-Fu� logic controller, PID, ball and beam, MATLAB,

ITAE.

I.

INTRODUCTION

An important set of existing systems of process industries are unstable by nature and essentially require feedback control for effective and safe performance [1]. However, a vital problem arises in the study of such real, unstable systems is that they cannot be brought into the laboratory for analyses. Due to its simplistic design and dynamic characteristics, ball balancing beam seems to be an ideal model for complex, non­ linear control methods. The ball and beam system is known to be the benchmark for both classical and modem control techniques. This system is widely used because of its simplicity to understand as a system and provides the opportunity to analyze the control techniques. The control task is to automatically adjust the position of the ball on beam by changing the control input i.e. angle of the beam. This is a complex task because the ball does not stay in one place on the beam but moves all the way with an acceleration that is proportional to the tilt of the beam. This system is an open loop unstable as the system output (ball position) is unbounded to a bounded input (beam angle). Therefore, a feedback control must be employed to maintain the ball in a desired position on the beam. Although PID control is a proficient technique for the handling of non-linear systems but modeling these systems is often troublesome and sometimes impossible using the laws of physics. Therefore, using a classical controller is not suitable for nonlinear control application [2]. Alternatively, Fuzzy Logic Control are useful when the processes are too complex for analysis by conventional quantitative techniques or when the available sources of information are interpreted

978-1-4244-6370-11$26.00 © 2010 IEEE

qualitatively, inexactly, or uncertainly [3]. It does not require any system modeling or complex mathematical equations governing the relationship between inputs and outputs. Fuzzy rules are very easy to learn and use, even by non-experts. It typically takes only a few rules to describe systems that may require several lines of conventional software code, which reduces the design complexity [4]. PID control requires the model of the system for the determination of the parameters of PID controller using control theory and finally the development of an algorithm for the controller. Whereas in case of fuzzy logic the system behavior is characterized using human knowledge which directly leads to the design of control algorithm on the basis of fuzzy rules. These rules are in terms of the relationship of inputs to their corresponding outputs, and precisely determine the controller parameters. Any adjustment or debugging only requires modification in these fuzzy rules instead of the redesigning the controller. Hence control technique based on fuzzy logic not only simplifies the design, but also reduces the monotonous task of solving complex mathematical equations for nonlinear systems. As a result, fuzzy logic controller delivers a better performance in cases where the conventional controller does not cope well with the non-linearity of a process under control [5]. In fuzzy control we focus on gaining an intuitive understanding of how to best control the process, then we load this information directly into the fuzzy controller. This paper describes an implementation of FLC. The design procedure utilizes MA TLAB® Fuzzy Logic toolbox and is implemented using SIMULINK® version 7.1. One of the great advantages of the Fuzzy Logic toolbox is the ability to take fuzzy systems directly into SIMULINK® and test them out in a simulation environment [6]. Although the authors have no experience of controlling the ball and beam system before, a somewhat better controller is designed based on the simple fuzzy rules. The triangUlar membership functions are used, and the centroid method is used for defuzzification. A classical PID controller has been also designed in MATLAB® for the system studied here, which will be used as a comparison to the FLC designed. The remainder of the paper is organized as follows. In Section II, we have presented a mathematical modeling of the ball and beam system. Section III discusses a design scheme of PID controller and Section IV describes the design of FLC. In Section V, a comparison has been made between PID and FLC based on simulation results. Finally in

V3-489

2010 2nd International Conference on Education Technology and Computer (ICETC)

section VI, we have concluded all the discussion presented in our paper. II.

LT m b

MATHEMATIC MODELING

Where the subscript

The Ball & Beam Control system is a multi-loop system which comprises of two parts. One is the mathematical model of the dc motor followed by mathematical model of the ball and beam system. The typical ball & beam control system is shown in the Fig. I.

=J

bm

.. m b

(5)

denotes the beam and motor, and

T m represents the torque generated by the motor. The torque b relation is given by

(6) Where K, is motor torque constant, and lin is the current supplied to the motor. From (1-6), it can be shown that a linearized model at 0° can be written as

Beam Desired

Position

(7)

Figure L Ball and Beam Control System

A.

Mathematical Model of the Ball and Beam

The system diagram given in Fig. 1 shows that there are three main components are involved in the system which includes moments and forces acting on them, the motor, the beam, and the ball. To simplify the design, the motor shaft and beam are considered to be the rigid body (i-e the stiffness across the transmission to be near the plane of ball contact, and there is no skidding). The sum of forces at the point of intersection can be written as LF b

= mg

sin - Fr = m x

Where 'a' is the angular displacement of the ball and (a') is the diameter of the ball used and (g) is gravity [7].

B.

Gm (s) =

(1)

Where the subscript b denotes forces acting on the ball, m is the mass of the ball, g is gravity, Fr is the rolling constraint forces on the ball and x is the position of the ball along the beam. By geometry, the position can be defined as

C.

T

'

2

b

= -rna 2

Where J is the moment of inertial of the ball, and b radius of the ball. The torque balance is given by

a is

(s) =

III.

(8)

0.7 4 0.0234s +1.713s3 +1.1991s2

(9)

DESIGN METHODOLOGY OF PID CONTROLLER

Fig. 2 shows the block diagram of the whole system. It consists of two loops: (1) Inner motor control loop (2) outer ball and beam loop. The design strategy is to first stabilize the inner loop followed by an outer loop control. (4)

5

lines)

0.7 _ __ s(0.014s+1)

= __

Overall Model of Ball and Beam System

G

Where a is the angular displacement of the ball, and a is the distance between the axis of rotation of the ball and point of contact of the ball with the beam. The torque balance of the ball, T is also a product of the rolling constraint force as b

8(s)

Based on the ball and beam specification of a = J . 5 cm (Radius of the ball), a' =9. 4227cm (for 271:), an overall model of the system can be written as

(2)

x=a'a

J

Mathematical Model of Motor

Based on the motor parameters, Km=O. 7Irevlsecivolts, T = 0.014 sec, J=1. 4x 10.6 Kg_m2, motor model can be written as

the

i Figure 2. Block Diagram of Ball and Beam System

V3-490

2010 2nd International Conference on Education Technology and Comp.uter (ICETC)

There are number of techniques to design the PID controller which involves Zigler and Nichols, SISO Tool, ITAE Equations, root locus, frequency reponse etc. In our design, we have used the ITAE equations for the PD and PID gains computation. The performance index ITAE provides the best selectivity of the performance indices; that is, the minimum value of the integral is readily discernible as the system parameters are varied [8]. The general form of the performance integral is I

These values were obtained by observing the corresponding values of e, L1e and control input u in the conventional system using the classical PID controller. Figures 3 and 4 show the membership functions used for the input and output variables. NL

NM

NS

Z

PS

PrL___

PM

T =

f f(e(t), r(t), y(t), t)dt

Figure

The following are the standard ITAE equations for characteristics equations of any control system up to order six

NL ____ __

3. Input e and f"..e Membership Function NM

Z

NS

PS

PM

PL

[9]:

S+OJn

s2 +I.4mn +OJr? s3+1.75liJnS2 +2.I5a�,?s+OJI? s4 +2IliJnS3 +3.4mn2s2+27%3s+%4 s5 +28liJnS4 +5.0OJ,,?s3 +5.5%3; +3.4mn4s+%5

2

Figure A.

s6 +3.25liJnS5 +6.60%2s4 +8.60%3� +7.45% 4; +3.95%5s+%6 For a damping ratio of c; = 0.6, the PD controller of the motor and PID controller for the outer loop can be seen in (10) and (11) respectively.

Grnotor( Controller) (S) GBall(Controller)(S)

=

2s

+ 11

5s2 +6s+0.2 =

S

-----­

(10)

B.

(11)

The rule base used in the design is given in Table I. The rule base follows closely the rules that were suggested in [3].

DESIGN METHODOLOGY OF FLC

For the fuzzification process, the triangular membership functions are used for both input and output with the universe of discourse as follows: • • •

Inference mechanism

The Inference Mechanism provides the mechanism for invoking or referring to the rule base such that the appropriate rules are fired. Using trial and error approach, the best inference mechanism to use in this case seems to be the min­ max method.

The main advantage for using the ITAE equation method for the calculation of gain is that there is no requirement for any graph or chart like the root locus and the bode plot. These equations can easily be used for the gains calculation of up to 6th order characteristics equation. After calculating the gains from the ITAE equations we require the little bit tuning of the gains. IV.

4 . Output Membership Function

e =[-1,1] iJe=[- I, I] V=[- 2, +2]

V3-491

Rule base

TABLE I. FUZZY RULE BASE



PL

PM

PS

Z

NS

NM

NL

NL

Z

NS

NM

NL

NL

NL

NL

NM

PS

Z

NS

NM

NL

NL

NL

NS

PM

PS

Z

NS

NM

NL

NL

Z

PL

PM

PS

Z

NS

NM

NL

PS

PL

PL

PM

PS

Z

NS

NM

PM

PL

PL

PL

PM

PS

Z

NS

PL

PL

PL

PL

PL

PM

PS

Z

C.

20iO 2nd international Conference on Education Technology and Computer (ICETC)

Defuzzification

10 ,---,---,----,---,,•

6

_

-

I I _ _I ___ L

, , , , 'I

I

I

J

:

I

8 � - - .J ___1___ .1

The defuzzification technique used was also found using trial and error. The defuzzification technique in this case that gave the least integral square error was the Centre of Gravity approach.

- -t

__

_ _

- - -1-

__

_

� ___:

- - 1"

_ __

-

- -I -

-

- -I

_

I _ .J

� .� �

- - t-

.

-

.

4

...

- -t

_

I I _ _ 1 _ _ _ 1. ID

P

. !:C

I __I __ _

' , ,

I:

_

___

- - -1 -



- - 1"

_

:

_____ _

- - -I

-

--

D. Scalingfactor o

Here the controller was tuned using input and output scaling factors to improve the performance of the system. The output scaling factor was needed to ensure that the control input u to the ball and beam is enough to move the beam accordingly in order to maintain its position. The scaling factors that were used are listed in Table II.

"F

lv, v···�·

-2

····

•••••••

,

,

Time(Sec)

Figure 6. Control Input Response for 80th Controllers TABLE II. SCALING FACTORS

Scaling factors e

1.4 ,---,----.--....,--,---,

Value used

1.2

- _ .1 ___1___ L __ .J ___ L __ .1 ___1___ L __ .J __

fl···' ······ ·.......... .

5

Lle

3

u

5

0.8

, " . .... ... .. ...... .. .. .. . .. .. .. .. .. .. .. .. .... .. .. .. ...... .. .

,.:'

i

0.6

Fig.5 and 6 show the error and control input for both type of

- - -1-

0.4

controller. A response of ball position for both type of controller is

shown in Fig. 7.

Fig. 8 shows the classical PID controller Simulink

1- __ .!... __ J __ , , ,

0.2

block diagram of the system. Whereas Fig.9 depicts the FLC

- - f, - --,1 --

- - _

Simulink diagram of the system

Time(Sec)

Figure 6. Output Response of PID and FLC

1.2 ,---,----,---,--,,---, 1



j -, I

. •• .••



I

-

_

I

I

__

.L -

- -' - - -

-- ..",..---1- - - +- - - -l 1\ I I I 0.6

f

w

0.4

0.2

o

-

-

I \ I I .... I

;-

-

\.�- -

-"...

I

- 1-

v.

- - - I- -

I - -1-

-

I

�'.

:::\- - � - - �\. I .... I

I

-

I

1

- - +-

I

I

- � - - _ _

I I - r - -"1

I

I

- - -l - - I

I

- - -1- - - 1- - --1---

- r - -, - --1- - - T - - -, - - -

- -:- - ��� - - -:- - - � - - � - - -:- - - � - - -: - --

,

__

1

_ _

I'" I_ .�.

1...

"'···· ••

I

L.

I

..

!....... ..... .! ... .... ... L ••••.••••••L ... ......I••••••.••.••

.2 � 0L---L---�--� 3,---4L--- � 5--�6--��--L8--�9--�10

Time(Sec)

Figure 5. Error Response for 80th Controllers

COMPARISON

From the simulation results shown in Fig. 7, it can be observed that the fuzzy controller has better transient response than the classical controller where the overshoot of the response is 0% compared to 16% in the classical case. The classical PID controller has a steady state error of 5% compare to a zero steady state error in FLC while the settling time of both systems is almost the same. VI.

CONCLUSION

An attempt to control the position of a ball in a ball and beam system using fuzzy logic has been proposed. From the simulation results, it has been shown that the fuzzy controller can stabilize the system efficiently Also, the performance during the transient period of the fuzzy system is better in the sense that less overshoot was obtained. Moreover, the fuzzy controller provides a zero steady state error.

V3-492

20iO 2nd international Conference on Education Technology, and Computer (ICETC) [3]

A CKNOWLEDGMENT The authors would like to thank The Islamia University of Bahawalpur Pakistan and Universiti Teknologi Malaysia for providing the facilities to allow the conduct of this research. REFERENCES [I] [2]

Peter Well stead, "Ball and Beam I: Basics", http://www.control­ systemsprinciples.co. uk/whitepaperslball-and-beam I.

Cihan Karakuzu, Sllkl iiztiirk ," A Comparison of Fuzzy, Neuro and Classical Control Techniques Based on an Experimental Application", University ofQuafaquaz, No. 6, pp I89-I98,July 2000.

C.C. Lee, Fuzzy logic in control systems: fuzzy logic controller -Part I and II", IEEE Trans. System Man Cybemet. SMC-20, pp. 404-435, 1990.

[4]

http://www.aptronix.com/fide/whyfuzzy.html.

[5]

Von Altrock, "Fuzzy Logic and NeuroFuzzy Applications Explained", Prentice Hall pp 82, 1995.

[6]

Fuzzy Logic Toolbox For Use with MATLAB, The Mathworks Inc., version 2, Natick, MA, 2006.

[7]

Evencio A. Rosales, A Ball-on-Beam Project Kit, Department Of Mechanical Engineering, Massachusetts Institute of Technology, June 2004 Francis H. Raven. Automatic Control Engineering, 5th ed, McGraw-Hili

[8]

Inc. [9]

D' Azzo, John J and Houpis, C. H. (1995). Linear Control System Analysis and Design: Conventional and Modem, 4th ed., McGraw-Hili Inc.

m---v-�€JI----I�I � Step

SS Controller

Motor Controller

Figure

8.

7

OO 4 S+1 Motor

PID Controller for Ball and Beam System

Figure 9. FLC Controller for Ball and Beam System

V3-493