Volume 02, No. 3, March 2016
P
age
53
Optimization of Fuzzy Controller Parameter by Using
A Firefly Algorithm
Soumya Chauhan
Department of Electrical Engineering, Deenbandhu Chhotu Ram University of Science and Technology, Murthal, Sonepat (Haryana) India
ABSTRACT:
Firefly Algorithm (FA) is one of the latest nature-inspired algorithms. Finding the best global optimal point, speed up the convergence by tuning the FA parameters and the ability of dealing with multimodality are some merits of FA. In this paper, FA is applied to tune optimal fuzzy parameters for FLC which are used in plant for liquid level and temperature control. MATLAB/ Simulink program has been used to achieve the optimal parameters of the membership functions. The results show clearly that the optimized FLC using FA has better performance compared to manually adjustments of the system parameters for different datasets.
KEYWORDS: Firefly algorithm, Fuzzy logic controller, Particle swarm optimization,
1. INTRODUCTION
Volume 02, No. 3, March 2016
P
age
54
solutions for a given optimization problem. There exist a diverse range of algorithms for optimization.
Firefly Algorithm (FA) is one of the latest nature-inspired algorithms. Finding the best global optimal point, speed up the convergence by tuning the FA parameters and the ability of dealing with multimodality are some merits of FA[39]. Fireflies cover the search space by random and information based steps which present two random search and local search to the algorithm respectively which conveys exploration and exploitation in firefly algorithm [33]. But, important point in firefly algorithm is keeping balance between exploration and exploitation. In standard firefly algorithm, controlling parameters of these two kinds of searches are initialized at the beginning and these values don‘t change until end of the searching process and this cannot indicate proper balance between these two kinds of searches considering different conditions that algorithm will be faced in different steps of solving problem. Therefore, we have used a fuzzy controller for tuning the parameters which control balance between random search and local search dynamically in each step of solving problem (with considering progress of solving problem). This method increases performance of the firefly algorithm in finding optimal solution by keeping balance between these two kinds of searches. We have used the proposed method for optimization of fuzzy controller parameters for a temperature and water level system.
In this paper, fuzzy controller (Mamdani type) to control of liquid level and temperature in tanks are used. We present optimization of Mamdani-type fuzzy regulator parameters using FA. MATLAB software is used for designing and simulating. This paper is organized as follows. In Section2, system model is presented. In Section3, the controller design based on Mamdani system is given. In Section4, Simulink model is presented. In Section5,FA is described. Finally, the results, conclusion and future direction are illustrated.
II. GENERAL FORMULATION OF THE SYSTEM MODEL OF LIQUID LEVEL AND TEMPERATURE
1. System Model for Level
The tank system [1-2] is shown in Fig. 1
Fig. 1: Schematic diagram of coupled tank system
Volume 02, No. 3, March 2016
P
age
55
= (1)
= - (2)
Where:
F =steady-state liquid flow rate, c /sec.
F = out flow rate from first tank, c /sec.
= out flow rate from second tank, cm3/sec.
And = coefficients, c /sec.
( = level first tank, cm. = level second tank, cm).
=the cross sectional area for first tank, c .
=the cross sectional area for second tank, c
2. SYSTEM MODEL FOR TEMPERATURE [29]
Fig. 2 depicts the circuit configuration for a simple Triac circuit where the primary power control device is the Triac whose gate firing device is the Diac (Skvarenina, 2002). The Diac is a fixed break-over voltage device compared to the Triac that permits a variable firing angle through its gate terminal. Compared to the Silicon Controlled rectifier (SCR) which is also gate controlled, the Triac permits device firing on the positive and negative half-cycles of the AC waveform.
Fig 2: Triac circuit
III. DESIGNING OF FUZZY LOGIC CONTROLLER
A. Fuzzy Logic Controller Review [1-2]
The basic fuzzy structure is shown in fig 3. The development of FLC consists following steps-
a) Specify the range of controlled variable and manipulated variables;
Volume 02, No. 3, March 2016
P
age
56
c) Determine the rule base to specify control action; d) Application of suitable defuzzification method.
The number of necessary fuzzy sets and their ranges were designed based upon the experience gained on the process. The standard fuzzy set consists of three stages: Fuzzification, Decision- Making Logic and Defuzzification.
Fig 3: Block Diagram of basic structure of fuzzy control system.
The controller in present work is Mamdani based one. It uses a rule based in linguistic terms. There are two inputs: error in liquid level and rate of change of liquid level and one output parameter: the inlet valve control angle in level control. Triangular membership functions are selected to fuzzify the inputs and output variables. The membership functions with five linguistic values for error (e) and change in error (de) is used and is shown in fig.4, 5.
Fig 4: Membership function for error Fig 5: Membership function for change in error
Volume 02, No. 3, March 2016
P
age
57
Fig 6: Membership function for output (rotation)
2. HAND-TUNED MEMBERSHIP FUNCTION FOR TEMERATURE
Fig 7: Membership function for error Fig8: Membership function
forchange-in-error
Volume 02, No. 3, March 2016
P
age
58
IV. SIMULINK BLOCK DIAGRAM DESCRIPTION
1. For Level
Simulink model for liquid level control and Fuzzy Logic Controller and by using program MatlabR2013. Based on the dynamic equations (1) and (2) a Simulink block diagram. Fig.2 showing the nonlinear model of the plant can be formed successively .Fig.3 shows the subsystem the Simulink block diagram of the nonlinear model of the plant. For pumping liquid is pumping capacity (F = 588 c \sec). Fig.4 showing the subsystem of stepper motor.
Fig.10 showing subsystem of flowrate using stepper motor and valve control and Fig.11 shows the subsystem 1 of valve control.
Fig 10: Simulink for Water level Control System with FLC
Volume 02, No. 3, March 2016
P
age
59
Fig 12: Subsystem of stepper motor
Fig: Subsystem of flow rate using stepper motor and valve control
Fig 13: Subsystem 1 of valve control
2. For Temperature
Volume 02, No. 3, March 2016
P
age
60
(t)]. In this the fuzzy sets e (t) (Temperature error) and de (t) (Change in temperature error) acts as the input. And the output is a firing angle which lies in the interval of [ ]. Here
through fuzzy output, get the firing angle which triggers the triac. Then fuzzy is further connected with triac circuit and through this firing angle calculate the value of TRAIC voltage (load voltage) from this formula(1).
V=f ( (1)
V=triac voltage
f ( = function of firing angle
Through this triac voltage, we have to calculate (Rms voltage) from TRIAC circuit.
Then, the value of will be put in the formula of power which is shown in formula (2)
P= (2)
In this formula, the value of R will be taken as a constant value. And the changes
according to the firing angle. The value of power will put in this formula (3) to get rise in temperature ( =100 ) which is shown in formula (3)
(3)
, P= power, t= time, density=1,
Volume 02, No. 3, March 2016
P
age
61
Fig 15: Subsystem 1 of AC source and measuring unit
Fig 16: Subsystem 2 of measuring unit
Volume 02, No. 3, March 2016
P
age
62
Fig 18: subsystem 4 of triac
Fig 19: Subsystem 5 of rise in temperature
V. FIREFLY OPTIMZATION ALGORITHM (FA)
Volume 02, No. 3, March 2016
P
age
63
tropic fireflies can even synchronise their flashes, thus forming emerging biological self-organized behaviour. We know that the light intensity at a particular distance r from the light source obeys the inverse square law. That is to say, the light which becomes weaker and
Fig 20: Flowchart of Fa
Weaker as the distance increases. These two combined factors makes most fireflies visual to a limit distance, usually several hundred meters at night, which is good enough for fireflies to communicate. The flashing light can be formulated in such a way that it is associated with the objective function to be optimized, which makes it possible to formulate new optimization algorithms. Use the following three idealized rules:[39]
1) All the fireflies are unisex so it means that one firefly is attracted to other fireflies irrespective of their sex.
Volume 02, No. 3, March 2016
P
age
64
brightness both decrease as their distance increases. If there no one brighter than other firefly, it will move randomly.
3) The brightness of a firefly is determined by the view of the objective function.
Input: f(X), X= ( )
m, // user defined constant
= f(X)
Output ;
For i=1: m
= initial _solution ( )
End
While (termination requirements are not met) do min argmi (f( )
fori= 1: m do for j 1 : m do
if j 1 : m do
if f( then
distance ( , )
attractiveness ( , )
(1- ). + + α. (random ()-1/2)
end if end j endi
+ α. (random ()-1/2)
end
Fig 21: Pseudo codes of FA
A. DESIGN ISSUES FOR CONSTRUCTION OF mfs [38]
Following design points are considered while constructing rule base and sfs for FAFLC:
1. Choice of Input Variables: We considered only 2 input variables, E(n) and R(n), each with 5 mfs and thus total number of rules & output mfs being 25 and 9 resp.
2. Choice of Input And Output Mfs: Exponential type of mfs (such as sigmoidal, Gaussian etc.) were avoided as their infinitely long tails add to noise only. For outermost fuzzy sets on UOD, particularly suited are non-exponential type zmf and smf (requiring only two defining parameters, each) and for the rest, triangular mfs, trimf, (requiring 3 parameters, each) were adopted. Defining equations are:
zmf(x;a,b) = 1 for x<=a,
Volume 02, No. 3, March 2016
P
age
65
= 2((x-b)/(b-a))2 for (a+b)/2 <= x <= b
= 0 for x >=b.
where parameters a and b locate extremes of sloped portion of curve.
smf(x;a,b) = 1 – zmf(x;a,b)
trimf(x;a,b) = max(min((x-a)/(b-a), (c-x)/(c-b)), 0)
where a,b,c respectively locate start, peak and end points.
B. DESIGN OF ADAPTIVE FITNESS FUNCTION
A performance criterion such as ISE is although quite general but has disadvantage of being unable to distinguish between persisting errors (even though well within tolerance band) and initial sluggishness. To cover more facets of time-response, a synthetic, more comprehensive fitness-function as follows is adopted:
Fitness-function= (w1+w2+w3+w4)/ (w1*ISE +w2*Mp+w3*tr+ w4*ts) (1) where w1,…,w4 are user-settable weights (free-parameters) to lay emphasis on different facets of response. Design of such a comprehensive fitness function needs much more attention in case FA-FLC is to operate at SPC. We considered following points in its design:
i) In synthesizing a comprehensive fitness function for a FA meant to tune an FLC operating at SPC, one cannot be oblivious of numerical properties/ scale of different factors constituting the fitness function. For instance, at higher SPCs, ISE can get numerically too dominant over Mp, tr and ts, so static chosen weights can mean that ISE is getting the tilt in its favour, totally eclipsing other performance indices. In other words, firefly good on all other accounts (viz. Mp, tr and ts) will keep on getting superseded by firefly poor on these accounts but dominant merely on account of ISE. We, therefore, felt a need to adapt fitness function by choosing weight w1 as follows: w1 = 0.2/(SPC)2.
ii) Values of w3 and w4 were held constant at 0.5 and 2 respectively, as these indices are relatively independent of SPC; latter weight is kept much higher as ts is generally more crucial than tr.
iii) w2 is adapted as follows depending upon whether Mp is within tolerance band (normal weight) or Mp exceeds it (heavily de-weighted):
If (Mp>0.05*abs(SPC)),
w2 =0.1/abs(SPC); else w2 = 0.5/sqrt(abs(SPC)
VI. EXPERIMENTAL RESULTS
Volume 02, No. 3, March 2016
P
age
66
Fig 28: Response of Level control with FLC
Fig 5.4 shows the response of fuzzy controller of water level of tank 2 with load disturbance at t = 5 sec under simulation environment
Fig 29: Response of water level of tank 2 with load disturbance
Volume 02, No. 3, March 2016
P
age
67
Fig 32: Membership function of Output
Fig 33: Response of water level of tank 2 with FA-FLC
FAFLC: Evolved mfs shown in Fig and correspond to following bestf firefly:
[-60, -36, -60, -36, 0, -36, 0, 24, 0, 24, 59.4, 24, 59.4, -1200, -720, -1200, -720, 0 ,-720,0, 480, 0,480, 1188, 480, 1188, 0,480.0,0,480.0,864,480.0,864,1104, 864, 1104, 1200, 1104, 1200, 1320, 1200, 1320, 1824, 1320, 1824, 2064, 1824, 2064, 2376, 2064, 2376]
Volume 02, No. 3, March 2016
P age
68
The greatest reductions in settling time has occurred which is a proof to great ability of FA for finding global search of a problem. After optimization of controller membership function, the main obvious changes can be interpreted as a significant lowering in rise time as shown in figure
FAFLC: Evolved mfs shown in Fig and correspond to following bestf firefly:
[-100, -60, -100, -60, 0, -60, 0, 40, 0, 40, 99, 40, 99, -2000, -1800, -2000, -1800, 0, -1800, 0, 1200, 0, 1200, 2970, 1200, 2970, 0, 1020, 0, 1020, 2160, 1020, 2160, 2760, 2160, 2760, 3000, 2760, 3000, 3300, 3000, 3300, 4560, 3300, 4560, 5160, 4560, 5160, 5940, 5160, 5940]
Table 1: Comparison between FA-FLC and FLC for temperature
FA-FLC FLC
Rise time ( ) 0.0355 0.1421
Settling time 0.5211 0.582
Overshoot 4.115 4.775
Table 2: Comparison between FA-FLC and FLC for water level
FA-FLC FLC
Rise time 0.3572 0.3760
Settling time 1.15 1.245
Table 3: Values of FA Parameters
Number of optimization variables 19
Number of alpha 0.55
Number of firefly (n) 30
Number of delta 0.97
Number of dimension(d) 51
Number of beta 0.20
Number of gamma 1
TABLE 4: Bounds for mfs of input and output variables and for input and output scaling factors of FLC
Note 1: (a,b)= points of zmf of smf (a,b,c) =points of trimf
Note 2; m =Multiplying Factor. Its value is SPC for E(n); 20*SPC for R(n) & 50*SPC for u(n)
lb ub
Bounds for mfs of inputs E(n) and R(n)
MN
SN
ZE
SP
Volume 02, No. 3, March 2016
P age
69
V. CONCLUSION AND FUTURE DIRECTION
With a large number of parameters (51 points of mfs for a two-inputs and one-output FLC), FLC design truly represents a search problem in high-dimensional, multi-modal hyperspace typically suited for FA. In this work, simulation experimental results on the control of level and temperature using firefly algorithm have been provided and it has been demonstrated that FA is an efficient method. FA-FLC outperforms a hand-tuned FLC.
Following new directions can be pursued: (a) adapting FLC for temperature and level control systems subjected to wide range of set-points. (b) adapting control parameters of FA.
REFERENCES
i. Dharamniwas, Aziz Ahmad, Varun Redhu and Umesh Gupta, ―Liquid Level Control by Using Fuzzy Logic Controller‖, pp. 537-549, July 2012
ii. Evelia Lizárraga Olivas, Oscar Castillo, Fevrier Valdez and José Soria, ―Ant Colony Optimization for Membership Function Design for a Water Tank Fuzzy Logic Controller‖ IEEE Transaction, 2013
iii. Majid Joshani, Rubiyah Yusof, Marzuki Khalid, A. Imam Cahyadi, ―Swarm Intelligence Based Fuzzy Controller – A Design for Nonlinear Water Level Tank‖, International Conference on Intelligent Systems Modelling and Simulation, 2012
iv. PROCYK, T. J AND MAMDANI, E. H. ―A Linguistic self-organizing process controller‖, Automatica, Vol. 15., pp. 15-30,1979
v. B. SUBUDHI AND A. K. SWAIN, ―Optimization of Membership Functions of Fuzzy Logic Controller for Controlling Liquid Level Using Genetic Algorithm‖, pp.77, Jan.— Feb. 1997.
vi. Ahmad Hatta bin Abdullah, ―Design and Development of Fuzzy Logic Based Level Controller‖, UniversitiTeknikal Malaysia Melaka, May 2008
vii. Harshdeep Singh, ―Design of Water Level Controller Using Fuzzy Logic System‖, National Institute of Technology Rourkela, Department of Mechanical Engineering.
viii. J.S. Saini and Y.P. Singh, ―Use of Causal Knowledge in a Real-time Fuzzy Logic Controller‖, IEEE Transaction, 1995
MP
Bounds for mfs of output u(n) VLN LN MN SN ZE SP MP LP VLP
Volume 02, No. 3, March 2016
P age
70
ix. W. Tan, ‗Water level control for a nuclear steam generator‘, Nuclear Engineering and Design, vol.241, pp.1873-1880, 2011
x. A. Shome and D. Ashok, ‗Fuzzy Logic Approach for Boiler Temperature and Water level Control‘, International Journal of Scientific and Engineering Research, vol.3, pp. 1-6, 2012
xi. O. Safarzadeh, A.Kahki Sedigh and A.S. Shirani, ―Identification and robust water level Control of horizontal steam generators using quantitative feedback theory‖, Energy Conversion and Management, vol.52, pp.3103-3111, 2011
xii. M.S Das Gupta, ―Fuzzy and ANN Controller Design and Implementation on a level control setup‖, UGC National Conference on advances on industrial automation, vol.2, March 2004.
xiii. Majid Joshani, RubiyahYusof, Marzuki Khalid, A. Imam Cahyadi, ―Swarm Intelligence Based Fuzzy Controller – A Design for Nonlinear Water Level Tank‖, International Conference on Intelligent Systems Modelling and Simulation, 2012
xiv. NamrataDey, Ria Mandal, M Monica Subashini, ―Design and Implementation of a Water Level Controller using Fuzzy Logic‖, International Journal, Vol 5 No 3, Jun-Jul 2013
xv. M.S.M Aras, M.F. Basar, N. Hasim, M.N. Kamaruddin, H.I. Jaafar, ―Development and Modeling of Water Tank System Using System Identification Method‖ ,International Journal, Volume-2, August 2013.
xvi. ZHAO Taoyan, LI Ping and CAO Jiangtao, ―Study of Interval Type-2 Fuzzy Controller for the Twin-tank Water Level System‖,Chinese Journal of Chemical Engineering, Vol. 20, Dec 2012.
xvii. K.Govinda, Sreekar.ch, Sandilya .k, ―Reservoir Water Level Indicator using UM66 Microcontroller‖,International Journal for Scientific Research & Development, Vol. 2, 2014
xviii. Daniel Wu, FakhreddineKarray, Insop Song, ―Water Level Control by Fuzzy Logic and Neural Networks‖, University of Waterloo
xix. P. Singhala, D. N. Shah, B. Patel, ―Temperature Control using Fuzzy Logic‖, International Journal of Instrumentation and Control Systems (IJICS) Vol.4, No.1, January 2014.
xx. Saeed Balochian, EshaghEbrahimi, ―Parameter Optimization via Cuckoo Optimization Algorithm of Fuzzy Controller for Liquid Level Control‖, Hindawi Publishing Corporation Journal of Engineering Volume, 2013
xxi. NaaJu Na, Zeugnam Bien, ―A Fuzzy Controller for the Steam Generator Water Level Control and its Practical Self-Tuning Based on Performance‖, Journal of Korean nuclear society, vol.27, no.3, 1995.
xxii. SurachaiPanich, ―Development of Fuzzy Controller for Water Level in Stream Boiler Tank‖, Journal of Computer Science 6 (11): 1233-1236, 2010.
Volume 02, No. 3, March 2016
P
age
71
xxiv. Isizoh A. N., Okide S. O, Anazia A.E., Ogu C.D, ―Temperature Control System Using Fuzzy Logic Technique‖, (IJARAI) International Journal of Advanced Research in Artificial Intelligence, Vol. 1, No. 3, 2012.
xxv. Seyed Kamaleddin Mousavi Mashhadi, Elham Sareban, Amir Aminian, ―Design Fuzzy Controller for Synthesis Water Level‖, Journal of mathematics and computer Science,vol.9 ,2014.
xxvi. P. J. King and E. H. Mamdani, ―The application of fuzzy control systems to industrial process,‖ Automatica, vol. 13, pp. 235–242, 1977
xxvii. W. J. M. Kickert and H. R. Van Nauta Lemke, ―Application of a fuzzy logic controller in a warm water plant,‖ Automatica, vol. 12, pp. 301–308, 1976
xxviii. Sven Fagerstrom and Nagy Bengiamin, ―Modelling and Characterization of Power Electronics Converters Using Matlab Tools‖, vol.1, pp. 133-165, 2012
xxix. Teccor electronics, ―Phase Control Using thyristors,‖ pp 1-9, 2002
xxx. Rabisankar Roy, Susmita Das, Jayanta Kumar Ray, Shreyashi Barat, BiswarupNeogi, ―Automatic Speed Control of Single Phase Induction Motor with the Variation of Ambient Temperature‖, ISSN 2250-3153,Volume 2, Issue 11, November 2012
xxxi. Disha, Mr.Pawan Kumar Pandey, Rajeev Chugh, ―Simulation of Water Level Control in a Tank Using Fuzzy Logic‖, ISSN: 2278-1676 Volume 2, Issue 3 ,PP 09-12,Sep-Oct 2012
xxxii. Zaid Abed AljasimMuhasain and Saif Abed AljasimMuhasain, ―Analysis and Design of Controller for Level Process Control without Sensor‖, (NUCEJ), Vol.13 No.1, pp.84-97, 2010
xxxiii. Xin-She Yang and Xingshi He, ―Firefly Algorithm : Recent Advances and Application‖, Int. J. Swarm Intelligence,2013, Vol. 1, No. 1, pp. 36-50.
xxxiv. Adelson Menezes Lima∗, Samequefariascunha De Oliveira, Missilene Da Silvafarias, Tarcisio Da Silvabarreto, Elmer Rolando Llanos Villarreal, ―Application the control in tanks using fuzzy theory‖, 2012
xxxv. Aniket B. Kabde, A. Dominic Savio, ―Position Control of Stepping Motor‖,Vol. 3, Issue 4, April 2014
xxxvi. Vasilija Sarac, ―Application of Matlab/Simulink in hybrid stepper motor modelling‖, 2013
xxxvii. Ahmad Johan Mahbob, MahanijahMd Kamal and FaiezaHanumYahaya, ―Water Temperature Using Fuzzy Logic‖, IEEE Transaction on CSPA, 2009
xxxviii. J.s. Saini, Dr. M.gopal, Dr. A.P. Mittal, ―Evolving Optimal Fuzzy Logic Controllersby Genetic Algorithms‖, Volume 50, Issue 3, pp.179-190, 2004
xxxix. X. S. Yang, Nature-Inspired Metaheuristic Algorithm, Luniver Press, Beckington, UK,
2nd edition, 2010