Design of a Fuzzy Logic Based Controller for Fluid Level Application

Abstract

In industrial process control, fluid level control is one of the most basic aspects. Many control methods such as on-off, linear and PID (Proportional Integral Derivative) were developed time by time and used for precise controlling of fluid level. Due to flaws of PID controller in non-linear type processes such as inertial lag, time delay and time varying etc., there is a need of alternative design methodology that can be applied in both linear and non-linear systems and it can be execute with fuzzy concept. By using fuzzy logic, designer can realize lower development cost, superior feature and better end product. In this paper, level of fluid in tank is control by using fuzzy logic concept. For this purpose, a simulation system of fuzzy logic controller for fluid level control is designed using simulation packages of MATLAB software such as Fuzzy Logic Toolbox and Simulink. The designed fuzzy logic controller first takes information about inflow and outflow of fluid in tank than maintain the level of fluid in tank by controlling its output valve. In this paper, a controller is designed on five rules using two-input and one-output parameters. At the end, simulation results of fuzzy logic based controller are compared with classical PID controller and it shows that fuzzy logic controller has better stability, fast response and small overshoot.

Share and Cite:

Shahid, H. , Murawwat, S. , Ahmed, I. , Naseer, S. , Fiaz, R. , Afzaal, A. and Rafiq, S. (2016) Design of a Fuzzy Logic Based Controller for Fluid Level Application. World Journal of Engineering and Technology, 4, 469-476. doi: 10.4236/wjet.2016.43047.

Received 10 February 2016; accepted 21 August 2016; published 24 August 2016

1. Introduction

Fluid level control system is a very complex system. It has many applications like chemical process, boilers, nuclear power plants etc. Emergency shut downs in the power plant is caused by poor control of the steam generator fluid level, which greatly affects the plant efficiency, consumption of time, maintenance of system and quality of material [1] . Therefore it is important to control the level of fluid to avoid the wastage of the material being processed and nonstability of a system [2] .

The automatic controlling of fluid level is an old technique but the technology adopted to do so is continuously advancing day by day [3] . PID is the feedback loop controller used frequently in the industries. This controller continuously calculates an error value as the difference between a measured output and a desired set point [4] ; however, it is difficult to get control efficiently because setting of its gains is a difficult task. It is hard to control nonlinear processes by using conventional linear PID controller. Therefore, it is essential to design a controller which controls the level of the fluid at its set point value and also it must accept the variable disturbances. Also, if the nonlinear process parameters values vary, all the parameters of controller must be modified in order to maintain the performance stability. To control nonlinear processes, an interesting approach called fuzzy logic is considered. Fuzzy logic can be understood as computation using linguistic variables as compare to numbers, whereas fuzzy control use IF-THEN statements instead of equations [5] - [7] .

In 1965, Lotfi Zadeh, a computer scientist at the University of California [8] , originated the fuzzy concept. As opposed to the modern control theory, fuzzy logic design is not based on the mathematical model of the process [5] . Fuzzy Logic eventually emerged as an entirely new discipline of artificial intelligence [8] . As compared to Boolean logic, in which value of variable is either 0 or 1, fuzzy logic is an imprecise logical system, in which the value of variable is lie between 0 and 1 [9] . The controller designed using fuzzy logic map human reasoning that has been programmed into fuzzy logic language. The fuzzy logic process involves the following steps, shown in Figure 1:

・ Input/output membership functions;

・ Rules;

・ Decision making (Interpretation of rules);

・ Defuzzification.

2. Overview of Fuzzy Logic

Fuzzy logic is perfect for such applications that resemble human decision making with an aptitude to generate particular solutions from definite or approximate data. Fuzzy logic does not require exact, detailed or noise free inputs. Despite a wide range of input variations, output control is a smooth function. Because of the rule based operation, any sound number of inputs can be processed and several outputs generated [3] . The main parameters of fuzzy logic theory are discussed briefly here:

2.1. Fuzzy Sets

In fuzzy set theory based on fuzzy logic, a specific object has a degree of membership in a given set that lies in the range between 0 (completely not in the set) and 1 (completely in the set).

2.2. Linguistic Variables

A linguistic variable has a label and meaning. Label may be a symbol or sentence in a language and meaning

Figure 1. Fuzzy logic process.

means fuzzy subset of a universe of discourse [10] . Linguistic variables are used to simplify the expression of rules and facts [11] .

2.3. Membership Functions

A membership function (MF) is a curve that defines how the value of a fuzzy variable in a certain region is mapped to a membership value (or degree of membership) between 0 and 1 [11] .

2.4. Shapes of Membership Functions

An MF can have different shapes. The simplest and most commonly used MF is the triangular-type, trapezoidal, Gaussian distribution curve, two-sided Gaussian, generalized bell, sigmoidal-type Polynomial-based curves e.g. Polynomial-Z and its mirror image, Polynomial-S and one that is zero at both ends but has a rise in the middle, Polynomial-Pi [8] .

3. Design and Simulation

There are several methods to implement fuzzy logic controller such as Mamdani method, Sugeno method and Lusing Larson method [8] . Mamdani method is the most commonly used fuzzy methodology so we are using this method in our controller design. The aim of designing this fuzzy logic based system is to control the level of fluid in tank at desired set point in short time by adjusting output valve. This system consist of two inputs, error and change in error, and one output, output valve. To control the inflow and outflow of fluid in tank, controller must read fluid level and flow rate at every sampling period. To design a simulation of this system, MATALB software is used. Fuzzy logic controller is designed using fuzzy logic toolkit of MATALB and tank simulations are performed in Simulink. The function of controller is to control the inlet valve of water tank depending upon how much fluid is required in the tank based on the outflow. Depending upon different possibilities of inputs, the output (valve) is controlled by fuzzy logic controller [12] [13] .

3.1. First Input

First input is defined as E (Error). It has three membership functions, shown in Figure 2, negative, ok and positive. 1st membership function is “negative” range from −1 to 0. 2nd membership function is “ok” range from −0.6746 to 0.659. 3rd membership function is “positive” range from 0 to 1.

3.2. Second Input

The second input is CE (Change in Error) has two membership functions, shown in Figure 2, negative and positive. 1st membership function is “negative” which has range from −0.1 to 0. 2nd membership function is “positive” range from 0 to 0.1.

3.3. Output

The output is named as OV (Output Valve). It has five membership functions, shown in Figure 3, close slowly, open slowly, no change, close fast and open fast. 1st membership function is “close fast” range from −1 to −0.8. 2nd membership function is “close slowly” range from −0.6 to −0.4 3rd membership function is “no change” range from −0.1 to 0.1. 4th membership function is “open slowly” range from 0.4 to 0.6. 5th membership functions; open fast ranges from 0.8 to 1.

3.4. Rules for Opening and Closing Valve of Tank

The design of fuzzy logic controller is based on the rules that are defined in the MATLAB/fuzzy rule editor, shown in Figure 4, the rules are based on mamdani inference method.

3.4.1. Rule 1

If there is no difference between inflow and outflow of fluid in tank then error is ok and there will no change in the position of the valve.

Figure 2. Inputs of fuzzy logic based system.

Figure 3. Output of fuzzy logic based system.

Figure 4. Rule editor in MATLAB/Fuzzy logic toolkit.

IF error (E) is OK and change in error (CE) is zero (ZE) then output valve (OV) is negative small (NC).

3.4.2. Rule 2

If the difference between outflow and inflow of fluid in tank is positive i.e. the water is flowing out more than it is being entered in the tank so the valve will be opened fast to balance the inflow and outflow.

IF E is positive (P) and CE is ZE then OV is open fast (OF).

3.4.3. Rule 3

If the difference between outflow and inflow of fluid in tank is negative i.e. more water is being filled in the tank as compared to its outflow so the valve will be closed fast to reduce the inflow and balance the difference.

IF E is negative (N) and CE is ZE then OV is close fast (CF).

3.4.4. Rule 4

If there is no difference between outflow and inflow of fluid in tank but slightly difference between entering and leaving of water, then valve will be closed slowly to balance the flow.

IF E is OK and CE is P then OV is close slow (CS).

3.4.5. Rule 5

If error between outflow and inflow of fluid in tank is fine but water is leaving the tank a little more than that its inflow, the valve will be opened slowly to balance the flow of water.

IF E is OK AND CE is N then OV is open slow (OS).

The above rules can also be written in tabular form shown in Table 1.

3.5. Calculation of OV

The rule viewer shows how the shape of certain membership functions influences the overall result, shown in Figure 5. The mathematical calculations of OV shown on rule viewer are given below;

Let us consider two points from rule viewer, 0.3486 on 1st input and 0.7545 on 2nd input.

In 1st rule, index of “e(t)” is at 0.38

(1)

Table 1. Rules for implementation of fuzzy controller.

Figure 5. Rule viewer of fuzzy logic controller.

In 2nd rule, index of “e(t)” is at 0.38

(2)

In 3rd rule, index of “e(t)” is at 0.

(3)

In 4th rule, index of “e(t)” is at 0.38 and that of “change” is 1.

(4)

In 5th rule, index of “e(t)” is at 0.39 and that of “change” is 0.

(5)

Integrating all DOFs using Mamdani method:

(6)

(7)

(8)

Fuzzy Inference System is knowledge and a rule based system. By assigning appropriate membership functions, the fuzzifier converts inputs, outputs and physical constraints into fuzzy variables. Fuzzy rules are mounted accordingly in the inference engine and fuzzy inference system of fluid level controller is implemented in the fuzzy logic controller and simulated to get the response of the controller to the given parameters. A MATLAB Simulink block diagram for fuzzy logic based fluid level controller is shown in Figure 6.

First of all, a same input is applied to fuzzy and PID controller. The rules are implemented in fuzzy controller and the controller performs the operation on valve according to the input condition. The valve will be opened or closed depending upon the level of fluid present in tank. An overflow flag will be raised if the fluid reached to the desire level. The output of fluid tank is sent back to input, the rate of change of error between outflow and inflow is fed to the mux with the input and the above process is repeated again. The response of fuzzy controller is then observed through fuzzy oscilloscope. Similarly PID controller controls the operation of fluid tank valve and its response is observed via PID oscilloscope.

4. Simulation Results

It is clear from Figure 7 that PID controller has a large overshoot as compared to the fuzzy controller and also takes a large time to stabilize at the desired level. On the other hand fuzzy logic controller has little overshoot and steady state error and stabilizes quickly providing accurate level control.

Figure 6. Implementation of fuzzy controller and PID controller in simulink.

Figure 7. Simulation results of fuzzy logic and PID controllers.

The observed parameters of Fuzzy and PID controllers from the graph are:

・ The output curve of FLC system stabilizes in 4 sec only, whether that of PID stabilizes in 15 sec.

・ The peak value of PID is 1.17 and that of fuzzy is 0.95.

・ The rise times of fuzzy and PID are 4.4 sec and 3.1 sec respectively.

5. Conclusions

In this paper, fuzzy logic controller is simulated on a level control problem with promising results. There is significant improvement in performance of controller over widely used PID in terms of oscillations, overshoot and settling time, as shown in Figure 7. The rise time in case of PID is less but it has larger overshoot and more settling time (15 s for our controller). However in case of fuzzy logic controller oscillations, overshoot and settling time is low, so FLC can be applied where oscillations cannot be tolerated.

The proposed fuzzy logic controller provides smooth operation in transient period. The output of PID controller stabilizes in 15 seconds while that of fuzzy logic controller in 4 seconds only. Hence, it is concluded that the conventional PID controller could not be used for the control of non-linear processes like level control. The fuzzy output can be made more accurate by fine tuning i.e. by adjusting parameters and range.

Conflicts of Interest

The authors declare no conflicts of interest.

References

[1] Singh, H.D. (2013) Design of Water Level Controller Using Fuzzy Logic System. National Institute of Technology, Rourkela.
[2] Shome, A. and Ashok, S.D. (2012) Fuzzy Logic Approach for Boiler Temperature & Water Level Control. International Journal of Scientific & Engineering Research.
[3] Banerjee, R. (2015) Water Level Controller by Fuzzy Logic. International Journal of Innovative Research in Advanced Engineering (IJIRAE).
[4]
https://en.wikipedia.org/wiki/PID_controller
[5] Singh, A., Thakur, Singh, H. and Wadhwani, S. (2015) Designing of Fuzzy Logic Controller for Liquid Level Controlling. Madhav Institute of Technology & Science.
[6] Wu, D., Karray, F. and Song, I. (2005) Water Level Control by Fuzzy Logic and Neural Networks. IEEE Conference on Control Applications, 3134-3139.
[7] Galzina, V., Saric, T. and Lujic, R. (2008) Application of Fuzzy Logic in Boiler Control. Technical Gazette, 15, 15-21.
[8] Bose, K. Modern Power Electronics and AC Drives. The University of Tennessee, Knoxville.
[9] http://link.springer.com/article/10.1007/BF00485052
[10] Bonissone, P.P. (1998) Linguistic Variables. GE Corporate Research & Development.
[11] Singhala, P., Shah, D.N. and Patel, B. (2014) Temperature Control Using Fuzzy Logic. Sarvajanik College of Engineering and Technology, Surat.
[12] http://www.mathworks.com/help/fuzzy/what-is-mamdani-type-fuzzy-inference.html
[13] http://www.mathworks.com/help/fuzzy/comparison-of-sugeno-and-mamdani-systems.html

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.