Sei sulla pagina 1di 9

PID control of water level in a coupled tank system

Rahat Hasan
Department of Engineering and Design, London South Bank University

Abstract
The idea of this experiment is to understand the application of PID control of water level in a coupled
Tank system which was achieved by understanding the operation of Feedback 33-230 Coupled Tank
system and relating it to the mathematical modelling of a single tank system. The tank was then
calibrated to display water level is cm. A PID control of water levels was performed on the coupled
tank system by adding each control terms and analysing the response of the system. Firstly, a “P”
control was applied to make the system stable, then a “D” control to reduce the oscillations in the
system and finally an “I” control to achieve a good output response. This was then followed by the
measurement of flow rate based on the level of water in the Tank. This involved capturing data as the
tank empties water, calculating the rate of volume of water drained from the tank using two points on
the curve and finally determining the Time Constant of the tank.

Introduction

Introduction to a Coupled Tank system


The coupled tank system consists of 4 tanks and a single reservoir, holding the main volume of water.
Each tank has two drains: one which allows constant flow from the top tank to the bottom tank, and
the other drain is operated manually with an additional valve. The top two tanks: Tank 1 and Tank 3
are manually coupled with valve MVG. The inlet water flow into the four tanks is controlled by the
two DC pumps. The inlets are manually closed or opened depending on the required configuration. It
is therefore possible to configure and control the coupled tank system from very simple to very
complicated applications. In this experiment only the water level in Tank 1 are controlled and if
successful, then both Tank 1 and Tank 2 are controlled simultaneously.

1
Mathematical Modelling of a Tank System
In a single tank system, the rate of water flow into the tank is proportional to the voltage applied to the
pump. The rate at which water flows out of the tank is non-linear and depends on the Height of the
Tank. The tank can be mathematically modelled as shown below:

The differential equation for the height, H, of the water in a tank is given by:
𝑑 𝑑𝐻
𝑉𝑜𝑙 = 𝐴 = 𝑏𝑉 − 𝑎√𝐻
𝑑𝑡 𝑑𝑡
Where,
Vol = the volume of water in the Tank.
A = the cross-sectional area of the Tank, (diameter 134mm).
b = Constant related to the flow rate into the Tank, (diameter 8mm).
a = Constant related to the flow rate out of the Tank, (diameter 8mm).
V = the voltage applied to the Pump, (0 – 5 volts).
H = the height (max 27cm) of water in the Tank, as a function of time due to the difference between
the flow rates into and out of the Tank. The equation contains one state, H, one input, V, and one
output H. The response is non-linear due to the square root of H.
A voltage of 2.85 V is applied to the pump to maintain a constant flow rate into and out of the tank at
a height of 13 cm.

Introduction to interface and how it works


An interface is a tool and concept that refers to a point of interaction between components, and is
applicable at the level of both hardware and software. This allows a component, whether a piece of
hardware such as graphic card or a piece of software such as an internet browser, to function
independently while using interfaces to communicate with other components via an input/output
system and an associated protocol.

2
Hardware interfaces exist in computing systems between many of the components such as the various
buses, storage devices and other I/O devices. A hardware interface is described by the mechanical,
electrical and logical signals at the interface and the protocol for sequencing them.
A software interface may refer to a range of different types of interface at different levels: an
operating system may interface with pieces of hardware. Applications or programs running on the
operating system may need to interact via streams, and in object oriented programs, objects within an
application may need to interact via methods [1].

Introduction to Proportional-Integral-Derivative (PID) Control Theory


In a PID control system, a Proportional Controller is simply multiplying the error in the system by a
variable gain known as the Proportional gain Kp, until a suitable gain achieves a reasonable response.
This gain increases the power in the system, however if it is increased beyond a certain level called
the critical gain, the system becomes unstable and goes into oscillations. Increasing the power in a
system is desirable as it quickens system response but at the expense of some overshoot. In some
systems a certain amount of overshoot is tolerated. The system can be improved by adding a second
term control method known as Derivative control. This method has a damping effect on
oscillations/overshoot by feeding back the speed/rate of change of the output as well as the output.
The Derivative gain Kd is varied until the oscillations are reduced or eliminated. The derivative
control method differentiates the error signal and comes into action only when there is a rapid change
in the error or the output of the system. The Integral control term is simply integrating the error signal
over a number of samples or a period of time and adding the result to the control signal. The Integral
Gain Ki is varied until the desirable response is achieved. This method is used in a control system in
which the output lags behind the demand by some offset or steady state error and has the effect of
eliminating the error. It also improves the rise time of the system [1].

Materials and Methods

Power up procedure
1. The PC is first powered up, then the UCI (universal control interface) is turned on and finally
the power to the Tank Rig is turned on.
2. The devices in the rig are connected to the Interface Card which are as follows:
 D/A channel 1 to Pump 1 driver.
 D/A channel 2 to Pump 2 driver.
 A/D channel 1 to tank 1 sensor.
 A/D channel 2 to tank 2 sensor.
 A/D channel 3 to tank 3 sensor.
 A/D channel 4 to tank 4 sensor.
3. The next step is the Simulink data acquisition. The Simulink model OneTANKTEST.mdl
enables to manually control the Pump on the rig and monitor the water levels using pressure
sensor signals. The sensor’s output is approximately 0 volts when the tank is empty and 3.2
volts at a height of 27 cm. the tanks overflow at 27 cm. It is important to calibrate the Tank
pressure sensors by recording the voltage values and converting the voltage level in cm [1]. A
picture of the model block is shown below:

3
Procedure on How to Run the Model
The steps followed to run the model are shown below:
1. Open Simulink Library Browser.
2. Build the model, i.e generate C-code, compile and link.
3. Connect to Target.
4. Run control on Target.

At step 2 the command window displays the code generation and compilation of the model. Once the
model is run, the simulation will run indefinitely until pressed stop. The slider gain block is the double
clicked to open it which will drive Pump 1. The value for Tank 1 sensor voltage is recorded and then
Pump 1 is driven at maximum speed by moving the slider to maximum of 5 volts. The Pump is
allowed to run at maximum speed until tank 1 is full and the voltage at Full level is recorded.

Procedure on Tank Calibration


The tank is calibrated so that the Simulink Displays show actual water levels in cm instead of voltages
which is a simple conversion formula which can be calculated from the sensor values of the water
levels at Empty and Full points. A voltage of 2.85 volts is applied to pump 1 to maintain the flow rate
into and out of the tank, so that water level remains at a height of about 13 cm. Using the Simulink
library “User Defined Functions”, the model is created which converts voltage to cm to calibrate the
tank. The volume of the water in the Tank is also calculated and another Function block is used to
display the volume [1].

Procedure on Estimation of flow rate


A second Simulink model file FlowData.mdl is used to measure the flow rate out of the Tank. The
model will run Pump 1 for 80 seconds until it overflow and then turns it off. It continues to capture
the data as the Tank empties. This model is coupled with another Matlab file flowdata.m which
displays the data on a figure for accessing data points on the response curve [1].

4
The model is executed for 120 seconds and then closed. The command prompt >>flowdata is typed in
Matlab command window.
The figure shown below has the x value of time and the y value of Height H of the tank as a voltage.
The rate of volume of water drained from the tank is measured using two points on the curve which is
then converted into Liters/min. The Time Constant of the Tank is also estimated from the figure.

5
Procedure on Water Level Control
Based on the calibrations, a closed loop system is created by adding blocks from the Simulink Library
browser. The model TankTest is shown below:

In order to perform proportional control, a PID block is set up to investigate Proportional control only
and the proportional gain is set to a value of above 1 while Derivative and Integral gain is set to zero.
The gain is increased in increments of 1 or less until it reaches Critical value and becomes unstable.
The system response for the P control is shown below:

To reduce oscillations a PD control is performed by increasing the derivative gain from a very low
value of 0.01 and thereafter in increments of 0.1. The system is tested repeatedly until the oscillation
is reduced or eliminated. The Integral gain should be set to zero. The system response for PD control
is shown below:

6
A slow or damped response can be achieved by setting the derivative gain to zero and the Integral
gain to 0.2 and thereafter in increments of 0.1 until a good output response is achieved.
Once a reasonable response is achieved in PD or PI control, a third term control is added and its value
is incremented by small amounts. The system is tested repeatedly until the best response is achieved.

Results and Calculations

Results for How to Run the Model


The value of Tank 1 sensor voltage when tank is empty = 0.752V.
The value of Tank 1 sensor voltage when tank is at full level = 3.125V.

Results for Tank Calibration


At height 0, sensor value = 0.752V.
At height 27cm, sensor value = 3.125V.
Points: (0.752, 0) and (3.125, 27).
Conversion formula:
𝒚 − 𝒚𝟏 𝒚𝟐 − 𝒚𝟏
=
𝒙 − 𝒙𝟏 𝒙𝟐 − 𝒙𝟏
𝑯−𝟎 𝟐𝟕 − 𝟎
=
𝑽 − 𝟎. 𝟕𝟓𝟐 𝟑. 𝟏𝟐𝟓 − 𝟎. 𝟕𝟓𝟐
𝑯
= 𝟏𝟏. 𝟑𝟕𝟖
𝑽 − 𝟎. 𝟕𝟓𝟐

7
𝑯 = 𝟏𝟏. 𝟑𝟕𝟖 𝑽 − 𝟖. 𝟓𝟓𝟔
The conversion formula is H = 11.378 V – 8.556.
Volume of the water in the Tank Calculation:
134
Radius of the Tank, r = 2
= 67 mm = 6.7 cm.

Height of the Tank, h = 27 cm.


∴ Volume of the tank = π r^2 h
= π × 6.7^2 ×13

= 3807.7 𝑐𝑚3 .
Testing the calibration and Volume Function
At full Tank:
Predicted height = 27cm.
Observed height = 26.93 cm.
Predicted volume = 3807.7 𝑐𝑚3 .

Observed volume = 3798 𝑐𝑚3 .

Results for Estimation of flow rate


Two points on flowdata figure are:

 x = 84.5, y = 2.226;
 x = 98.6, y = 1.035.
2.226−1.035
∴ Gradient of the curve =
84.5−98.6

= - 0.0845 cm/s.
∴ Rate in cm = -0.0845 cm/s.
Rate of volume of water drained from the tank = π ×r^2×h/s
= π ×6.7^2 × -0.0845

= -11.917𝒄𝒎𝟑 /𝒔.
Calculation for Time Constant
Time constant is the time taken to get to 63.2% of the final value.
Final value = 2.606 cm.
∴ 63.2% of the final value = 63.2/100 ×2.606 = 1.647 cm.
∴ Time taken to reach 1.647cm or Time Constant of the tank = 44.2 seconds.

8
Discussion
 The signal is noisy when the tank is being filled due to the water droplets dropping from a
height.
 The system response has not changed when Integral control is introduced to the existing PD
control.

Conclusion
The first objective is achieved by understanding how the feedback 33-230 Coupled Tank
System works and what are the various components involved. The second objective was to
mathematically model a single Tank system which is achieved by analysing the model from
Simulink. The third objective was to perform a PID control of water levels in a coupled tank
system which is done by recording the value of Tank 1 voltage and then varying the Pump 1
speed. The Tank is then calibrated so it shows actual water levels in cm instead of voltage.
Then a second Simulink model of flow rate estimation is executed and the readings are noted.
The last objective is to perform a measurement of flow rate based on the water level which is
achieved successfully by creating a closed loop PID control and then tuning the PID to
achieve the best response.

References
1. T. Sattar. Experimental note of CTTanks from Control Systems. Lectures delivered in
Circuits, signals and systems, Lab Room T405. London South Bank University, 3 Feb 2013.

Potrebbero piacerti anche