You are on page 1of 7

ISSN 2320 6020


Control Strategies for Water Level Control of Two Tank System

Pawan Kumar Kushwaha and Vinod Kumar Giri*
ABSTRACT- Level sensors detect the level of substances that flow, including liquids, slurries, granular materials, and powders. Fluids and
fluidized solids flow to become essentially level in their containers because of gravity whereas most bulk solids pile at an angle of repose to a peak.
The substance to be measured can be inside a container or can be in its natural form. The PID controller calculation involves three separate constant
parameters, and is accordingly sometimes called three-term control; the proportional, the integral and derivative values, denoted as P I and
D. Heuristically, these values can be interpreted in terms of time; P depends on the present error, I on the accumulation of past errors, and D is
a prediction of future errors, based on current rate of change. The weighted sum of these three actions is used to adjust the process via a control
element such as the position of a control valve. An abundant amount of research work has been reported in the past on the tuning of PID controllers.
Internal model control and error-integral criteria tuning formulae are to mention only a few. The control of liquid level in tanks and flow between
tanks is a problem in the process technologies. The process technologies require liquids to be pumped, stored in tanks, and then pumped to another
tank systematically. The conventional control algorithms are difficult to reach required control quality.In this paper we present an efficient
elementary idea about the PID controller system, fuzzy logic controller and water level control for water tank system has been presented. The
result shown in the paper is encouraging & promising.

KEY WORDS: PID Controllers, Fuzzy Logic Controller, Water Level Control, SISO.
Proportional Integral Derivative (PID) controllers are widely
used in industrial practice since last six decade. The invention
of PID control is in 1910 (largely owing to Elmer Sperrys
ship autopilot) and the straightforward Ziegler-Nichols (Z-N)
tuning rule in 1942 [1]. Today, PID is used in more than 90%
of practical control systems, ranging from consumer
electronics such as cameras to industrial processes such as
chemical processes. The PID controller helps to get our output
(velocity, temperature, position) where we want it, in a short
time, with minimal overshoot, and with little error [2]. It also
the most adopted controllers in the industry due to the good
cost and given benefits to the industry [3]. Many nonlinear
processes can be controlled using the well-known and
industrially proven PID controller [4]. A considerable direct
performance increase (financial gain) is demanded when
replacing a conventional control system with an advanced one
[4]. The maintenance costs of an inadequate conventional
control solution may be less obvious. The tricky part of
controller design is to figure out just how much of a corrective
effort the controller should apply to the process in each case.
Some situation requires tighter control of the process variable
than On-Off control can provide. Proportional control
provides better control because its output operate linearly
anywhere between fully ON and fully OFF [5]. As its name
implies, its output changes proportionally to the input error
signal. Proportional controller simply multiplies the error by a
constant to compute its next output.
Author: Pawan Kumar Kushwaha is currently
pursuing Master of Technology program in Electrical
Engineering in MMM. Engg. College, Gorakhpur
India, E-mail:
*Co-Author: Vinod Kumar Giri is Associate Prof. in
MMMEC Gorakhpur India.

In 1930s the control engineers discovered that the error could

be eliminated altogether by automatically resetting the set
point to an artificially high value [3, 6]. The PID controllers
function is to maintain the output at a level that there is no
difference (error) between the process variable and the set
point in as fast response as possible Fuzzy logic is derived
from fuzzy set theory. It deals with reasoning, approximation
rather than precise values. The concept of Fuzzy Logic (FL)
was conceived by Lotfi Zadeh, a professor at the University of
California at Barkley and presented not as a control
methodology. Fuzzy logic allows intermediate values to be
defined between conventional evaluations like true/false,
yes/no, high/low, etc. Some of the controllers with their
mathematical equation are as follows.
Proportional Controller
In a controller with proportional control action, there is a
continuous linear relation between the output of the controller
m (manipulated variable) and actuating error signal e.
m (t) = Kp e ( t )
Where Kp is known as proportional gain or proportional
Integral Controller
In a controller with integral control action, the output of the
controller is changed at a rate which is proportional to the
actuating error signal e (t).
d/dt m(t) = K i e (t)
Where K i is a constant.
Derivative Controller
In a controller with derivative control action the output of the
controller depends on the rate of change of actuating error
signal e.
Mathematically m (t) = K d d/dte(t)
Where K d is known as derivative gain constant.
Proportional-Plus-Integral Controller
This is the combination of proportional and integral control
Mathematically m( t ) = K p e(t) +K p K i e(t)dt


ISSN 2320 6020


Qo3 =flow rate of fluid between tanks

Proportional-Plus-Derivative Controller
When a derivative control action is added in series to
proportional control action, then this combination is termed as
proportional-derivative control action. Mathematically it can
be defined as
m (t) = K p e(t) + K p T d d/dte(t)
Proportional-Plus-Integral-Plus Derivative Controller
The combination of proportional, integral and derivative
control action is called PID control action and the controller is
called three action controllers. Mathematically
m (t) = K p e(t) + K p T d d/dte(t) + K p 1/Ti e(t)dt
2 Mathematical Modeling of Coupled Tank System
Before the process of designing controller begin, it is vital to
understand the mathematics of how the coupled tank system
behaves. In this system, nonlinear dynamic model are
observed. Four steps are taken to derive each of the
corresponding line arise perturbation models from the
nonlinear model. Fig 1 shows the schematic diagram of
coupled tank system.

Qi1, Qi2 = pump flow rate into tank 1 and tank 2 respectively
Qo1, Qo2 = flow rate of fluid out of tank 1 and tank 2
Each outlet drain can be modeled as a simple orifice.
Bernoullis equation for Steady, non-Viscous an
incompressible show that the outlet flows in each tank is
Proportional to the square root of the head of water in the tank.
Similarly, the flow between the two tanks is proportional to
the square root of the head differential.
Qo1 = 1H1


Qo2 = 2H2


Qo3 = 3H1 H2


Where 1, 2, 3 are proportional constants which depend on

the coefficients of discharge, the cross sectional area of each
orifice and the gravitational constant. Combining equation (3),
(4) and (5) into both equation (1) and (2), a set of nonlinear
state equations which describe the system dynamics of the
coupled tank are derived.
A1 dH1/dt = Qi1 1H1 - 3H1 H2


A2 dH2/dt = Qi2 2H2 - 3H1 H2


2.2 A Line arise Perturbation Model

Suppose that for a set of inflows Qi1 and Qi2, the fluid level
in the tanks is at some steady state level H1 and H2. Consider
a small variation in each inflow, q1 in Qi1 and q2 in Qi2. Let
the resulting perturbation in level be h1 and h2 respectively.
From equations (6) and (7), the equation will become:
Fig 1: Schematic Diagram of Coupled Tank System

For Tank 1
A1 d (H1+ h1) /dt = (Qi1 + q1) 1 (H1 + h1) - 3H1 H2
+ h1 h2 (8)

2.1 A Simple Nonlinear Model of Coupled Tank System

A simple nonlinear model is derived based on figure 1. Let
H1and H2 be the fluid level in each tank, measured with
respect to the corresponding outlet. Considering a simple mass
balance, the rate of change of fluid volume in each tank equals
the net flow of fluid into the tank. Thus for each of tank 1 and
tank 2, the dynamic equation is developed as follows.
A1 = dH1/dt Qi1 Qo1 Qo3
A2 = dH2/dt Qi2 Qo2 Qo3


For Tank 2
A2 d (H2+ h2) /dt = (Qi2 + q2) 2 (H2 + h2) + 3H1 H2
+ h1 h2 (9)
Subtracting equations (6) and (7) from equation (8) and (9),
the equations that will be obtained are,
A1 dh1 /dt = q1 1( (H1 + h1 -H1) - 3(H1 H2 + h1
h2 - H1 - H2


A2 dh2 /dt = q2 2( (H2 + h2 -H2) + 3(H1 H2 + h1

h2 - H1 - H2

H1, H2 = height of fluid in tank 1 and tank 2 respectively

A1.A2 =cross sectional area of tank 1 and tank 2 respectively

For small perturbations,


ISSN 2320 6020


H1 + h1 = H1 (1 + H1/2 H1)

A2sh2(s) = q2(s) (2 /2H2 + 3 /2H1 H2) h2(s) +

3h1(s)/ 2H1 H2 (21)


Rewritten equation (20) and (21)

H1 + h1 - H1 h1/2H1
A1 dh1/dt = q1 qo1 3 (h1 h2 )/2H2 H1
A2 dh2/dt = q2 qo2 3 (h1 h2)/2H2 H1

(T1s +1) h1(s) = K1q1(s) + K12h2(s)


(T2s +1) h2(s) = K2q2(s) + K21h1(s)



Where, qo1 and qo2 represent perturbations in the outflow at

the drain pipes. This would be appropriate in the case where
outflow is controlled by attaching an external clamp for
2.3 First Order Single Input Single Output (SISO) Plant

For the second order configuration that shows on figure 1, h2

is the process variable (PV) and q1 is the manipulated variable
(MV). Case will be considered when q2 is zero. Then,
equation ( and ( will be expressed into a
form that relates between the manipulated variable, q1 and
the process variable, h2 and the final transfer function can be
obtained as,

This configuration is considered by having the baffle

completely depressed so that there is no flow between the two
tanks. Equation (6) and (7) can be simplified to become first
order differential equation.
A1dh1/dt = q1 1h1/2H1


A2dh2/dt = q2 2h2/2H2


Taking the level of fluid at tank 1 that will control, the output
variable h1 represents a small change in the steady state level
H1 and q1 is a small change in the steady state input flow rate
into tank 1, Qi1. H1 is also the steady state operating points
and isa constant. Performed Laplace transform on equation
(15) will become,
Fig 2: Block Diagram of Second Order Process
From equation (17), the time constant of the tank 1 dynamics
can be expressed

The steady state gain of the tank 1 dynamics is

Kt= 2H1 /1

In this section the discussion is about the designing of

controller that will control level fluid at tank 1 on coupled tank
system. The purpose controller that needs to design is PID
Controller. The designing of controller are divided into two
methods. Each value of 1, 2, 3, A1, A2, H1 and H2 can be
obtained from calibrate experiments manual CTS-001 book
that also been provided with this plant and those values are:
10.78, 11.03, 11.03, 32, 32, 17, and 15 respectively.


2.4 Second Order Single Input Single Output (SISO) plant

This configuration is considered by having the baffle raised
slightly. The manipulated variable is the perturbation to tank 1
inflow. Performed laplace transform of equation (13) and (14),
and assuming that initially all variables are at their steady state
A1sh1(s) = q1(s) (1 /2H1 + 3 /2H1 H2) h1(s) + 3h2
(s)/ 2H1 H2

After solving equations the value of T1, T2, K1, K2, K12, and
K21 are: 6.1459, 6.0109, 0.1921, 0.1878, 0.749, and 0.7325

0.036 (25)
36.942 s2 + 12.1568s + 0.451

Designing of Fuzzy Logic Controller

By using fig. file in Matlab 8.0 the Fuzzy logic block is
prepared and the basic structure of this file is as shown in
figure. Here Mamdani type of rule-base model is used. This


ISSN 2320 6020


produces output in Fuzzified form. Normal system need to
produce precise output. A defuzzification process is to convert
the inferred possibility distribution of an output variable to a
representative precise value. The work is done by using
centroid defuzzification principle in the given fuzzy inference
system. In this min implication together with the max
aggregation operator is used.

entire span of the input set, the surface viewer is required.

Figure shows the surface view of the system under

Figure 5: Surface viewer of Fuzzy logic based PID

Fig. 3: Fuzzy Inference System

Shown FIS is having seven input member function for both
input variables leading to 7*7 i.e. 49 rules. Figures show these
rules using rule viewer.

The surface viewer has a special capability that is very helpful

in cases with two or more inputs and one output: we can
actually grab the axes and reposition them to get a different
three dimensional view on the data.
A membership function characterizes a fuzzy set. The value of
membership function represents a degree of membership to
the fuzzy set, which is between 0 and 1. A fuzzy set with the
sharp membership function curve has higher resolution and
control sensitivity. With the smooth one, the stability of
system is better but resolution is lower. Fuzzy control rules is
a set expressed by fuzzy language, which describes the
mapping relationship of inputs and outputs.
The fuzzy rules of Kp, Ki and Kd for the controllers are
expressed in the rule matrices as shown in table.
Table 2: The fuzzy rules table of Kp

Figure 4: Rule viewer of Fuzzy logic based PID

The rule viewer shows a map of the whole fuzzy inference
process. The first two columns of plots show the membership
functions of the antecedent, or then if part of each rule. The
third column of plots shows the membership functions of the
consequent, or then part of each rule.
The rule viewer shows one calculation at a time in great detail.
In this sense, it presents a sort of micro view of the fuzzy
inference system. If the entire output surface of system is to be
viewed. That is, the entire span of the output set based on the

The above table 1 shows the fuzzy rule base for tuning the
PID parameter of proportional gain Kp. There are total 49
rules in the above table.


ISSN 2320 6020


each parameter will also be tuned in this software and the

validity for each parameter will be compared using the
reference value (set point). Figure 3 shows the MATLAB
simulink block for PID Controller combines with plant.

Table 3: The fuzzy rules table of Ki

The above table 2 shows the fuzzy rule base for tuning the
PID parameter of proportional gain Ki. There are total 49 rules
in the above table.
Table 4: The fuzzy rules table of Kd

Fig 7: Block Diagram of PID Controller combines with

4.1 Simulation result without controller
In this section the simulation result without the controllers has
been shown.

The above table 3shows the fuzzy rule base for tuning the PID
parameter of proportional gain Kd. There are total 49 rules in
the above table.

Fig 8: Plot of Liquid Level at the Coupled Tank 1

Fig.6: Fuzzy PID controller designed using Simulink tools
In this section the designing of PID Controller to control
coupled tank system using MATLAB software. This software
is used to create the simulink model for PID Controller and
performance for each parameter for PID Controller has been
The performances of PID Controller are evaluated in terms of
overshoot, rise time and steady state error. Then, the gain for

It may be observe that from the figure 4, the liquid will

constantly overflow. This situation happen because of this
system running without controller to control the Pump 1
speed, so the Pump 1 will continuously pump the liquid out
from the tank until it overflow. PID controller must be put as it
controller element so that the liquid will not overflow and will
indicates as required.
4.2 Simulation result with PID Controller
In this section the simulation result with the PID Controllers
has been shown.


ISSN 2320 6020


Fig 11: Plot Performance of Proportional-Integral


Fig 9: Plot Performance of Proportional Controller

Figure 12: Plot Performance of PID Controller

Fig 10: Plot Performance of Proportional-Derivative

Figure 5 shows the performance of proportional controller.
The set point is set equal to 3 and the proportional gain is set
20. The plot shows that proportional controller reduced both
the rise time and the steady state error. Proportional controller
also increased the overshoot and decreased the settling time by
small amount.
Figure 6 shows the performance of proportional-derivative
controller. The set point is set equal to 3. The proportional
gain is set equal to 20 and derivative gain is set equal to 10.
This plot shows that the derivative controller reduced both the
overshoot and the settling time but had small effect on the rise
time and the steady state error.

Figure 7 shows the performance of proportional-integral

controller. The set point is set equal to 1. The proportional
gain is set equal to 20 and integral gain is set equal to 12. The
plot shows that integral controller also reduced the rise time
increased the overshoot same as the proportional controller
does. The integral controller also eliminated the steady state
Figure 8 shows the performance of PID Controller. The set
point is set equal to 3. The proportional gain is set equal to 12,
integral gain is set equal to 4 and derivative gain is set equal to
7 to provide the desired response. The plot shows that the
output voltage achieves the set point voltage at time equal to
10 second. The output voltage have slightly overshoot before
stabilize at time equal to 20 second.
Table 1 shows the effects of increasing proportional, integral
and derivative parameters.


ISSN 2320 6020


Table 1: Effects of change of the parameter




From the simulation results shown in fig (4, 5, 6, 7 & 8) it may
be concluded that PID controller eliminates the offset of the
proportional mode and still provides fast response. This can be
used for virtually any process condition including this water
level controller. The PID controller is one of the most
powerful but complex controller mode operations combines
the proportional, integral, and derivative modes. This system
can be used for any process condition including controlling
water level in a tank. The water level can be controlled
continuously without manual adjusting of the valve. The PID
algorithms will automatically response to the system so that
the system is stabilized near the set point.



4.3 Simulation result with Fuzzy PID Controller




J. Swder, G. Wszoek, W. Carvalho, Programmable

controller design Electropneumatic Systems, Journal
of Material Processing
Technology 1641655(2005) 14659-1465
Terry Bartelt, Industrial Control Electronics: Devices,
Systems and Applications, Second Edition, Delmar,
Aurelio Piazzi and Antonio Visioli, A Noncausal
Approach for PID control Journal of Process Control,
4 March 2006.
S. Gerksic et al. / Control Engineering Practice 14
(2006) 935948, Advanced Control Algorithms
Embedded in a Programmable Logic Controller, 22
July 2005.
Paul H. Lewis and Chang Yang (1997). Basic
Control Systems Engineering: Prentice Hall.
Carl Knopse, Guest Editor, PID Control, IEEE
Control System Magazine, February 2006.
S. Bennett, Development of the PID controller,
IEEE Contr. Syst. Mag., vol. 13, Dec. 1993, pp. 58
S. Song, L.Xie and Wen-Jim Cai, Auto-tuning of
Cascade Control Systems IEEE Proceedings of the
4th world Congress on
Intelligent Control and
Automation, June 10-14, 2002, Shanghai, P. R.
China, pp 3339-3343.
K. Passino, Towards bridging the perceived gap
between conventional and intelligent control, in
Intelligent Control: Theory and Applications, IEEE
Press, 1996, ch. 1, pp. 127. Gupta, M. M. and
Sinha, N. K. editors.
K. Passino, Bridging the gap between conventional
and intelligent control, Special Issue on Intelligent
Control, IEEE Control Systems Magazine, vol. 13,
June 1993, pp. 1218.
Wikipedia, the free encyclopedia.

Figure 13: Plot Performance of Fuzzy PID Controller

Hence it may be concluded that the Fuzzy PID controller is the
most effective controller that eliminates the offset of the
proportional mode and still provides fast response. That is
why Fuzzy PID controller has been chosen. It may be further
stated that because of the action of Proportional parameter, the
plot result will respond to a change very quickly. Due to the
action of Integral parameter, the system is able to be returned
to the set point value. The Derivative parameter will measure
the change in the error and help to adjust the plot result