You are on page 1of 28

1

(Lab Project Report)

Project Title:-
MATLAB-Simulink model of the liquid level
control system with PID controller.

Subject:-
Linear Control System
2

Supervised By:-
Sir Adnan Rasheed

Group Members:-
 Danyal Qamar (BEET-023R19-08)
 Areeb Waqar (BEET-0223R19-09)
 M Umair Altaf (BEET-023R19-10)

Department:-
BSc Electrical Engineering

Semester:-
5th
3

1. Introduction to Mat lab Simulink


2. liquid level control system with PID controller
3. Design and Components.
4. Process.
5. Final Circuit.
6. Outputs
7. Conclusion
4

1:-Introduction

MATLAB:
MATLAB is a proprietary multi-paradigm
programming language and numeric computing environment
developed by Math Works. MATLAB allows matrix
manipulations, plotting of functions and data, implementation of
algorithms, creation of user interfaces, and interfacing with
programs written in other languages. It  is a programming
platform designed specifically for engineers and scientists to
analyze and design systems and products that transform our
world. The heart of MATLAB is the MATLAB language, a
matrix-based language allowing the most natural expression of
computational mathematics.
5

Simulink:
Simulink is a MATLAB-based graphical programming
environment for modeling, simulating and analyzing multi domain
dynamical systems. Its primary interface is a graphical block
diagramming tool and a customizable set of block libraries.

Liquid level control:


Fluid level control is a mechanism, device, or system which
monitors, compares, and regulates the level of liquids or gases within a
process to a set value. Level measurement determines the position of the
level relative to the top or bottom of the process fluid storage tank or
silo.
6

A Conductive Level Controller electrically detects the level of a


liquid. When the electrodes are in contact with liquid, the circuit is
closed (the liquid completes the path for electricity to flow) and the
electrical current that flows in this circuit is used to detect the level of
the liquid.

2: liquid level control system with PID controller


This work is based on a PID control of the
level of the water in a tank. The user has the power to choose a certain
level of water and the system has to be capable of adjusting itself in
order to maintain that certain level. To that, a Lab View program was
built, this program gives the user the possibility to choose the level of
the water, and by constant recalculations(Fig.1), involving the error
generated by the input value and the output value, the output value is
adjusted in order to be closer to the desired level.

PID Loop Control


7

To do that is necessary to constantly read the


input value that in this case is the current level of the water, and for that
the system has the NI USB-6008 acquisition board, that enables several
inputs and two outputs of 5V. This system has two inputs and one
output, the inputs are the two readings of the level of water in the tanks,
the upper and the lower tank and the single output is the voltage that the
pump needs to receive in order to start working.

NI USB-6008 Acquisition Board

PID Controller:
“The PID controller is by far the most common control
algorithm. Most feedback loops are controlled by this algorithm or
minor variations of it. It is implemented in many different forms, as a
stand-alone controller or as part of a DDC (Direct Digital Control)
package. Many thousands of instrument and control engineers
worldwide are using such controllers in their daily work.
8

A PID controller is a controller that includes the proportional element,


“P element”, the integral element, “I element” and the derivative
element, “D element”.
Defining u (t) as the controller output, the final form of the PID
algorithm is:

Where:
Pout: Proportional term of output
Kp: Proportional gain, a tuning parameter
Ki: Integral gain, a tuning parameter
Kd: Derivative gain, a tuning parameter
e: Error = SP − PV
t: Time or instantaneous time (the present)
MV: Manipulated variable

Feedback Control:
The success of feedback control is because this system makes
everything faster, more precise and less sensitive to disturbances. The
open loop control, regarding its simplicity, it’s only advised in system
9

when the outputs and inputs are known and in which there is no
disturbance associated.
In system with feedback control there is a big disadvantage which
is the probability of the system get unstable, for that the correct
controller must be chosen, and it must be perfect for the system that is
being monitored.
The basic structure of conventional feedback control systems is
using a block diagram representation. The purpose is to make the
variable y follows the Set-point r. For that, the variable u is manipulated
at the command of the controller. The variable d is considered as
disturbances. The disturbance may be any factor that influences the
process variable.

 Plant – The physical parts of the system that is supposed to be


controlled;
 Feedback – from the devices that measure the variable we want to
control;
 Error Signal – Error = Set Point – Measured;
 Disturbances – A disturbance is all of the things that can drive a
system to error, not considering the error talked above. A
10

disturbance in the system that is talked after is for example,


interference on the electrical system.
 Controller – The controller can be considerate the most important
part of this system. It will read the Set Point, process the error, and
give the output to the Plant. It’s very important that the system
works correctly, and for that there are several methods of tuning
the constant talked above. Those methods are being explained
ahead.

Integral term:
The integral influence is proportional to the variation of the
error on time. The integral term is given by:

The most important benefit is that this term eliminates the steady-state
error, but it has a disadvantage which is the fact that the stability of the
system is affected to. Regarding the upper equation we can conclude that
this integral term depends on pass values of the error

Derivative term:
The derivative term is proportional to the rate of change of the
error, as we can see on the equation below.
The derivative term is given by:
11

This term makes an estimation of the future error and by that it


can increase or decrease the speed of correction, because it can work in
an early way when there are detected any changes on the error. This
term is very sensitive to disturbances.
If the derivative term only changes with the rate of change of the
error, if the error do not change then we don’t have derivative influence.

FUNDAMENTAL CONTROL METHODS:


On-off, proportional (P), proportional-derivative (PD),
proportional-integral (PI), and PID controls are fundamental control
methods employed to regulate process variable to a specific set point in
industrial control systems. These methods were initially realized using
mechanical devices and after that, they were designed by pneumatic and
analog electronic devices. In on-off control, a controller opens or closes
a final control element in accordance with the case in which the process
variable is over or under the set point value. PID control is one of the
most basic methods widely used in industrial control systems. The
method can be easily applied to the systems with linear and simple
structure. In contrast, it is quite difficult to apply nonlinear systems
especially when with dead time delays. The general output equations of
the PID controller in time and Laplace domains are given as follow:
12

Where u (t) is the controller output signal fed to the process to be


controlled, e (t) is the error
Signal: The difference between the set point and the measured process
variable (e (t) = r (t) –b (t)), Kp, Ki and Kd are the controller gain
parameters, Ti is the integral time constant and Td is the derivative time
constant. The gain parameters Ki and KD in Laplace domain equation
are calculated by the equations Ki = Kp/Ti and Kd = Kp. Td,
respectively.
PID control accumulates itself all characteristic features of P
control, I control and D control and thus, sometimes called three-term
control. This type control is usually used more quickly to stabilize the
process controlled by PI control.

Setting of the PID controller gain parameters:


In the setting of PID controller parameters by the
Ziegler-Nicholas’s (Z-N) sustained oscillation method, the sufficient
knowledge and experience about the process makes possible more
13

accurate and faster parameter optimization. This method is experimental


and subjects the closed loop control system to an experiment through
only proportional gain.
As a result of the applying of the processing procedures to the controller
connected to the process, the data required for the calculation of gain
parameters are obtained experimentally. Then, these data are placed in
the equations in Table, recommended by Ziegler and Nichols, and the
final values are obtained for the gain parameters Kp, Ki and Kd.

Table. According to the Z-N’s sustained oscillation method.

MATHEMATICAL MODEL AND SIMULATION:


Before proceeding to the implementation stage, the
knowing of how to exhibit a dynamic behavior of liquid level control
systems is vital in terms of the determining of a number of parameters
related to the system in the design stage. The dynamic behavior of a
system can be observed and analyzed through some simulation studies
after the obtaining of the mathematical model to the system. As in many
physical systems, liquid level control systems also exhibit a non-linear
14

dynamic behavior due to the inherent characteristics. Nevertheless, the


theories and theorems in control systems, the most of which can be only
applied to linear systems, necessitates to be modeled nonlinear systems
as a linear system. When considering small changes in the level control
system, the system can be modeled with linear differential equations. In
this section, the linearization of a nonlinear liquid level control system
model has been discussed. The schematic diagram of the first order
liquid level control system is

A schematic diagram of the liquid level control system

This system consists of a tank with an inlet (control) valve and


outlet (load) vane and represents a single input single output (SISO)
control system. In the system, while the outflow liquid from the tank is
manually controlled through the load vane, the inflow liquid into the
tank is adjusted by a proportional valve. Normally, the outflow liquid
from the tank is a load which is needed by process and continuously
changes due to reasons beyond control. Therefore, the inflow liquid into
15

the tank represents a manipulated variable (MV) depending on the liquid


level. The outflow liquid from the tank refers to a load or a disturbance.
The top of the liquid tank is open and it has a cylindrical structure. The
dimensions and some calculations of the liquid level control tank are
given in Table.

Table: The dimensions of the tank

The liquid level control system has been modeled taking into account
the change in the liquid level, which results from the difference between
the inlet flow rate and outlet flow rate of the liquid in the tank.
The characteristic equation of the obtained transfer function,
simply the denominator of this function, is first order. Therefore, the
dynamic behavior of the system is defined in form of time constant.
When the calculated the resistance of the liquid level system R and the
16

capacitance C (m3/m) values in Table, the transfer function of the liquid


level control system is achieved by:

APPLICATION:
The liquid level set whose experimental setup has been constituted on a
prototype and its DAQs are shown in Fig.

Figure: (a) The liquid level control system with computer-controlled and (b)
DAQs

The communication between the DAQ cards and the SCADA


software on the PC is done by ATS A-4520L DAQ RS232-RS484
converter The RS232 communication protocol is employed in the data
communication from the PC to the DAQ cards. Besides, the RS485
17

communication protocol is used to transfer the data from the DAQ cards
to the PC. The DAQ cards are fed by Mean weal power supply of 24 V
DC and 100 W. The computer-based PID control algorithm is carried
out over the DAQ SCADA program developed by the authors.
The liquid level in the tank is sensed through Foxboro
differential pressure transmitter. The transmitter has a measurement
range of 0-6.6 kPa. The high pressure input of the transmitter PH is
connected to the bottom side of the cylindrical tank
PH = Patm+ Pliquid
Also, the low pressure input of the transmitter PL is left open to
the atmospheric pressure
PL = Patm
Since both the top of the tank and the low pressure input of the
transmitter are left open to the atmospheric pressure, the transmitter
output changes depending on the height of the liquid level in the tank
Pdifference =PH – PL = Pliquid
Water is used as the process variable to be controlled in the
system. The specific gravity of water is about 998.2 kg/m3 at 1 atm and
20°C. The laboratory temperature, in which there exists the experimental
set, is about 20°C.
18

3:-Design and Components


Following components are used to design the liquid level
control system with PID controller:
Step:
The Step block provides a step between two definable levels at a
specified time. If the simulation time is less than the Step time parameter
value, the block's output is the Initial value parameter value. For
simulation time greater than or equal to the Step time, the output is the
Final value parameter value.

Sum:
The Sum block performs addition or subtraction on its inputs. The
Add, Subtract, Sum of Elements, and Sum blocks are identical blocks.
This block can add or subtract scalar, vector, or matrix inputs. It can also
collapse the elements of a signal and perform a summation.
19

Gain:
The Gain block multiplies the input by a constant value (gain).
The input and the gain can each be a scalar, vector, or matrix.You
specify the value of gain in the Gain parameter.
The Multiplication parameter lets you specify element-wise or matrix
multiplication. For matrix multiplication, this parameter also lets you
indicate the order of the multiplicands.

Integrator:
The Integrator block outputs the value of the integral of its input signal
with respect to time. Simulink treats the Integrator block as a dynamic
system with one state. The block dynamics are given by:

x(t)y(t)=u(t)=x(t)   x(t0)=x0
 u is the block input.
 y is the block output.
 x is the block state.
 x0 is the initial condition of x.
20

Derivation:
The Derivative block approximates the derivative of the input
signal u with respect to the simulation time t. You obtain the
approximation of
du/dt,
By computing a numerical difference Δu/Δt, where Δu is the change in
input value and Δt is the change in time since the previous simulation
(major) time step.

ADD:
The Sum block performs addition or subtraction on its inputs.
This block can add or subtract scalar, vector, or matrix inputs. It can also
collapse the elements of a single input vector.
You specify the operations of the block with the List of Signs parameter.
Plus (+), minus (-), and spacer (|) characters indicate the operations to be
performed on the inputs.
21

Transfer function:
The Transfer function block models a linear system by a
transfer function of the Laplace-domain variable s. The block can model
single-input single-output (SISO) and single-input multiple-output
(SIMO) systems.

 The transfer function has the form

Where u and y are the system input and outputs,


respectively, nn and nd are the number of numerator and
denominator coefficients, respectively. Num (s) and den(s) contain
the coefficients of the numerator and denominator in descending
powers of s.
 The order of the denominator must be greater than or equal to the
order of the numerator.
 For a multiple-output system, all transfer functions have the same
denominator and all numerators have the same order.
22

Scope:
The Scope block displays its input with respect to simulation
time. The Scope block can have multiple axes (one per port); all axes
have a common time range with independent y-axes. The Scope allows
you to adjust the amount of time and the range of input values displayed.
You can move and resize the Scope window and you can modify the
Scope's parameter values during the simulation.
23

4:-Process
The process to make liquid level control system with PID controller is
described below step by step:
Open the Simulink library in MATLAB.
Then we add our required components from library to our workspace.
These components are:
 Step
 Sum
 Gain(kp)
 Gain(ki)
 Gain(kd)
 Integrator
 Derivative
 Add
 Transfer function
 Scope
Then connect all the components.
After connecting all the components run the program.
Then the output graph shows on new window.
Then we find the step response, pole zero’s map, bode plot, impulse
response.
24

5:-Final Circuit

The final circuit that we have designed using Simulink is given below
25

6:-Outputs
The outputs that we obtained from our projects are explained
below according to their graph.

Transfer function (with initial output):


26

Step response:

Pole Zero Map:


27

Impulse response:

Bode diagram:
28

7:-Conclusion
In this study, modeling and application of a computer
controlled liquid level tank system was executed for practical
applications of conventional PID control method. The results of the
experimental studies were clearly carried out the fundamental control
algorithms on the liquid level process. By means of the DAQ-SCADA
software containing a visual and flexible interface, the process could be
controlled by the computer-based control structures and analyzed under
the different operating conditions in detail.
For next studies, other control algorithms would be
applied on the installed liquid level process. Then the results of these
algorithms would be compared with each other as simulation results and
experimental results.

You might also like