# Parameter Optimization via Cuckoo Optimization Algorithm of Fuzzy Controller for Liquid Level Control

Authors: Saeed Balochian; Eshagh Ebrahimi
Journal: Journal of Engineering
 (2013)

---

## Abstract

Cuckoo optimization algorithm (COA) is one of the latest evolutionary algorithms. Finding the best optimal point, rapid convergence, and simplicity in determining algorithm parameters are some merits of COA. In this paper, COA is applied to tuning optimal fuzzy parameters for Sugeno-type fuzzy logic controllers (S-FLCs) which are used for liquid level control. A programmable logic controller (PLC) is used with fuzzy controller. For this purpose, a liquid level control set and PLC have been assembled together. MATLAB/Simulink program has been used to achieve the optimal parameters of the membership functions. The results show clearly that the optimized FLC using COA has better performance compared to manually adjustments of the system parameters for different datasets.


---

## Body

## 1. Introduction

FLC is a popular technique that has seen increasing interest in the past decades since it has a linguistic based structure and its performance is quite robust for nonlinear systems. Takagi-Sugeno (T-S) fuzzy models represent fuzzy dynamic models or fuzzy systems [1–8]. This brings a twofold advantage. First, any model-based technique (including a nonlinear one) can be applied to the fuzzy dynamic models. Second, the controller itself can be considered as a fuzzy system. Since the fuzzy model of the nonlinear process is usually based on a set of local linear models which are smoothly merged by the fuzzy model structure, a natural and straightforward approach is to design one local controller for each local model of the process. However, FLC including some parameters such as linguistic control rules and limits and type of membership functions has to be tuned for a given system. A major drawback of FLC is that the tuning process becomes more difficult and very time consuming when the number of the system inputs and outputs is increased. Evolutionary algorithms regarding tuning the membership function parameters of FLC have been studied extensively in the literature. These studies can be divided into three groups as genetic algorithm [9–13], PSO [14–19], and ant algorithm [20, 21].In many industrial processes, control of liquid level is required. Several researchers have investigated the problem of controlling liquid flow [22–28]. A constrained predictive control algorithm based on feedback linearization applied to a coupled tank apparatus is given in [29]. In [30], several sliding mode control schemes for the coupled tanks system and liquid level control are proposed. Fuzzy logic is as a powerful problem-solving methodology with a great number of applications in level control. Intelligent control including fuzzy control [31–36], neural network control [37], and genetic algorithms [38] has also been applied to liquid level system.PLCs have been commonly used in manufacturing and industrial process applications. Main advantages of PLCs are simplicity, flexibility, reliability, and easy system configuration with low cost, low maintenance, and running cost. For this reason, complicated technology is shifted to the PLC process control system. Furthermore, PLC-based process control system enables easy operation and engineering [39]. The right choice of an optimization algorithm can be crucially important in finding the right solutions for a given optimization problem. There exist a diverse range of algorithms for optimization. One of the latest and most powerful optimization algorithms is cuckoo optimization algorithm (COA) [40, 41]. The ability of COA to find the best optimal point, rapid convergence, and simplicity in determining algorithm parameters and to handle any type of cost function for large scale problems makes it a better tool than the traditional gradient descent algorithms, genetic algorithm (GA) and particle swarm optimization (PSO) algorithm [42].In this paper, fuzzy controller (Takagi-Sugeno type) with PLC to control of liquid level in tanks is used. According to the characteristics of PLC, the fuzzy control is used with PLC. We present optimization of Takagi-Sugeno-type fuzzy regulator parameters using COA. MATLAB software is used for designing and simulating. This paper is organized as follows. In Section2, system model is presented. In Section 3, the controller design based on Takagi-Sugeno system is given. In Section 4, COA is presented. In Section 5, determination of Takagi-Sugeno controller parameters based on COA is considered and comparison to PSO is discussed. Finally, the results and advantages of the method are illustrated.


## 2. System of Liquid Level

In this system, the flowing of water has been supplied via a pump from a storage tank, and the flowing water rate has been adjusted with an actuator. This actuator operates with an electropneumatic positioner. A PLC (S7-200) has been used to control of the liquid level system. The level of the liquid has been measured through a pressure transmitter. The transmitted pressure data is transferred to PLC by using an analog input module [39]. This data which is between the ranges of 4–20 mA have been converted tomBar, and this mBar values come up to liquid level of tank in cm (0–60 cm). The system used in this work has been shown in Figure 1.Figure 1
Schematic diagram of the liquid level control system.The system model can be represented by the following differential equation:(1)dh(t)dt=-c2gh(t)A(h(t))+1A(h(t))u(t),
where u(t) is the input flow (control input), which can be positive or negative; that is, it can both pull liquid out of the tank and put it in, h(t) is the liquid level (the output of the plant), A(h(t)) is the cross-sectional area of the tank, g=9.8m/s is gravity, and c is the known cross-sectional area of the output pipe [43]. The block diagram of the water tank which is obtained by (1) is shown in Figure 2.Figure 2
Block diagram of the water tank.


## 3. Controller Design

Fuzzy parameters of the membership functions have been determined using MATLAB/Simulink program. Triangular-shaped built-in membership functions have been used in the Sugeno-type fuzzy algorithm. This fuzzy controller has two input variables:e(t) is the error which is the difference between set value and process value and de(t)/dt is the differential of e(t) and an output variable which is the control signal of the actuator [39]. Output variable (stimulus control signal) includes two acts that increase and decrease. Output membership functions have three parameters. Linear-type output membership functions have been used in fuzzy rule base which has four fuzzy rules. Fuzzy rules are as follows(i)
ife is positive and de is positive then output is increased.(ii)
ife is positive and de is negative, then output is increased.(iii)
ife is negative and de is positive, then output is decreased.(iv)
ife is negative and de is negative, then output is decreased.The final output of the system is the weighted average of all outputs, which is computed by(2)Y=∑i=1nμimfi∑i=1nμi,
where μi compute from if part and mfi is output membership function of the ith fuzzy rule.The fuzzy controller output is applied to the actuator in order to control of water level. Then, the required flow of water has been adjusted to obtain the desired level. The flowchart of PLC program is shown in Figure3. Simulation of the control system is realized in MATLAB/Simulink, which is shown in Figure 4.Figure 3
Flowchart of the PLC program.Figure 4
Simulation of the control system.


## 4. Cuckoo Optimization Algorithm (COA)

COA is inspired by the life of a bird family which is called cuckoo. Special lifestyle of these birds and their characteristics in egg laying and breeding has been the basic motivation for development of this new evolutionary optimization algorithm. The cuckoo population, in different societies, is in two types: mature cuckoos and eggs. The effort to survive among cuckoos constitutes the basis of COA. During the survival competition, some of the cuckoos or their eggs demise. The survived cuckoo societies immigrate to a better environment and start reproducing and laying eggs. Cuckoos’ survival effort hopefully converges to a state in which there is only one cuckoo society, all with the same profit values. Figure5 depicts flowchart of COA [44].Figure 5
Flowchart of COA.Like other evolutionary algorithms, the COA starts with an initial population of cuckoos. These initial cuckoos have some eggs to lay in some host birds’ nests. Some of these eggs which are more similar to the most bird’s eggs have the opportunity to grow up and become a mature cuckoo. Other eggs are detected by host birds and are killed. The grown eggs reveal the suitability of the nests in that area. The more eggs survive in an area, the more profit is gained in that area. Hence, the position in which more eggs survive will be the term that COA is going to optimize. Cuckoos search for the most suitable area to lay eggs in order to maximize their eggs survival rate. After the remained eggs grow and turn into a mature cuckoo, they make some societies. Each society has its habitat region to live in. The best habitat of all societies will be the destination for the cuckoos in other societies. Considering the number of eggs each cuckoo has and also the cuckoo’s distance to the goal point (best habitat), some egg laying radii are dedicated to it. Then they immigrate toward this best habitat. They will inhabit somewhere near the best habitat. Then, cuckoo starts to lay eggs in some random nests inside her egg laying radius. This process continues until the best position with maximum profit value is obtained and most of the cuckoo population is gathered around the same position. More details regarding the COA can be found in [44].


## 5. Fuzzy Controller and COA Parameters

Output membership functions parameters of Sugeno fuzzy controller included 6 parameters, that is, three parameters related to the increase and three parameters related to the decrease. These parameters are determined using COA. Interval variables of the controller parameters are selected in the range of −10 to 500. In Table1, the parameters of COA are presented.Table 1
Values of COA parameters.
Number of optimization variables
6
Number of initial population
5
Minimum number of eggs for each cuckoo
2
Maximum number of eggs for each cuckoo
3
Maximum iterations of the cuckoo algorithm
100
Number of clusters that we want to make
2
Maximum number of cuckoos
8
Population variance
1
e
-
3We define a cost function according to (3) as
(3)Cost=sse(y-y^)+100×Overshoot,
where sse is sum squared error performance function, y is reference step input and y^ is output of the Simulink model. Cost function received COA maximum population matrix, and then set the parameters of controller. After setting, the parameters of the controller are called the simulink model and output is shown using the scope in Simulink. Figure 6 shows diagram of the reduction of the cost function.Diagram of the cost function reduction.
(a)
(b)


## 6. Simulation Results

In Figures7 and 8, the simulation results without COA are shown. The level has been set to 30 cm at t=0s and 40 cm at t=10s and then the level has been set to 50 cm at t=20s.Figure 7
A view of the oscilloscope screen without optimization (level set: 30, 40, 50 cm).Response of the manually tuning controller parameter.
(a)
Level set: 30
(b)
level set: 40
(c)
Level set: 50In Figures9, 10, and 11, the simulation results using COA and PSO are shown.Figure 9
Response of fuzzy controller tuned using COA and PSO (set level = 30 cm att=0s).Figure 10
Response of fuzzy controller tuned using COA and PSO (level set: 40 cm att=10s).Figure 11
Response of fuzzy controller tuned using COA and PSO (level set: 50 cm att=20s).Table2 shows the values ​​of the optimal output membership functions parameters of Sugeno fuzzy controller using COA and PSO algorithm.Table 2
Optimal parameters values of fuzzy controller.
Level set: 30 cm
Level set: 40 cm
Level set: 50 cm
Using COA
Using PSO
Using COA
Using PSO
Using COA
Using PSO
Best parameters to decrease
138.6451
500
313.1306
500
407.4101
500
-
9.3154
-
10
-
7.5503
−10
-
5.8901
-
10
30.4182
106.9814
48.0356
−10
54.4692
135.3138
Best parameters to increase
179.0782
500
126.3613
500
274.8582
500
-
5.1364
-
10
-
6.1710
−10
-
7.0941
-
7.016766
66.5813
−10
63.9597
121.9906
70.7508
−10Comparison between the control results obtained from FLC (manually adjustments) and optimized FLC clearly shows that optimized FLC has more accurate and acceptable results rather than manually adjustments of the system parameters for different datasets. The results show that tuned controller using COA is better and even superior to tuned controller using PSO.


## 7. Conclusion

In this paper, an efficient and effective tuning approach-based COA is presented to obtain the optimal Sugeno fuzzy controller parameters for control liquid level. Despite the fuzzy controller, the controller is ideal for liquid level control, and the results show that it can improve the performance of fuzzy controller by optimizing the parameters. Simulation results show clearly that the optimized controller parameters have better performance compared withmanually adjustments of the system parameters for different datasets and COA could demonstrate its capability to tune up fuzzy controller parameters promptly with uppermost level of accuracy.



---

*Source: 982354-2013-03-31.xml*