Proportional Plus Integral Control For Water Level in A Tank

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 30

MAPUA UNIVERSITY

SCHOOL OF ELECTRICAL, ELECTRONICS, AND COMPUTER ENGINEERING

Proportional plus Integral Control for Water


Level in a Tank
EXPERIMENT NO. 1

Submitted by:
Group 2 - EE113L/E06
Castillo, Dioselle
Mondejar, Dionel
Perido, Tamiya
San Jose, Rafaela Yvonne
Tuliao, Ybeth Angelyn

Submitted to:
Engr. Conrado Ostia
EXPERIMENT NO.1
Proportional Control for Water level in a Tank
Objective:
1. To familiarize the student in using MATLAB Simulink.
2. To control the water level in a tank using Proportional controller.
3. To demonstrate the components of the model and its subsystems.
4. To simulate the model.

Theoretical Discussion:
Proportional control is a control system technology based on a response in proportion to the difference
between what is set as a desired process variable (or set point) and the current value of the variable. It is used
where maintaining a process variable to a tighter tolerance and timely responsiveness are required. Control
systems in many industrial settings as well as some smart devices use proportional control.
Proportional control involves fine-grained control through a feedback mechanism. In comparison to the
on-off control of a traditional bi-metallic strip-switched domestic thermostat, devices that use proportional
control are more complex. The variable response is linearly proportional to the differential between a process
variable and the desired optimum set point. This means that the response of the controller and the mechanism
for affecting the variable make a greater response for a greater differential and a smaller change for a smaller
differential. The variability of the response to the process variable means tighter tolerances can be maintained.
When automating dangerous machinery, handling of sensitive materials and chemical processes, proportional
control makes processes and production safer and more reliable.
In the proportional control algorithm, on–off control will work where the overall system has a relatively
long response time, but can result in instability if the system being controlled has a rapid response time.
Proportional control overcomes this by modulating the output to the controlling device, such as a control valve
at a level which avoids instability, but applies correction as fast as practicable by applying the optimum quantity
of proportional gain. This can be mathematically expressed as:
P=K c + E

Where,
P = Proportional Control Mode
K c = Controller Gain

E = Error
P=K p e p ( t )

Where,
P = Proportional output
K p = Proportional Gain

e (t )=error=SP−PV
t=time∨instantaneous time
Combined water tank systems are used in many resident areas. Most of the time they are functioning
well, but there is some condition that the system faces the problem of overflows because of the system cannot
detect whether the water level have properly reached the desired level or the flow-in rate of the water are not
proportional with the flow-out rate. It can cause the water tank system empties faster than it fills up.
Consequently, the pressure of the water cannot support the distribution of the water to the resident area.
Construction of new tank, valve or system could be the solution to completely eliminate the problems.
However, such schemes are expensive and can also be extremely disruptive because the system networks may
extend across wide geographical areas. Alternatively, controlling the flow between parts of the system which
are under different loading can reduce the overflow spills. Actuated valve can be opened or closed to control the
flow past a certain point.
Consider a cylindrical tank with no outlet flow and an adjustable inlet flow that is controlled by a valve.
The inlet flow rate is not measured but there is a level measurement that shows how much fluid has been added
to the tank. The objective of this exercise is to develop a controller that can maintain a certain water level by
automatically adjusting the inlet flow rate.

Reference/s:
https://www.mathworks.com/help/fuzzy/water-level-control-in-a-tank.html
https://whatis.techtarget.com/definition/proportional-control

Equipment:
• MATLAB Simulink

Procedure:
1. Getting Started with Simulink
A. To start MATLAB, click on the MATLAB icon on your desktop.
B. In the command window type “open_system(‘sltank’)”.
C. A Simulink window will open. The model of a Water Level Control in a Tank.
D. Remove Fuzzy Logic Controller block and everything that is connected to it (the block does not cover this topic).

Figure 1.1 Water Level Control Model


2. Components of the Model

A. For the input of the Sum1 block, the constant block is connected to the positive, and the Signal Generator block is
connected to the negative.
B. Set the constant value of the Constant block to 1.
C. To set the parameters for the Signal Generator block, double – click the block and set the waveform to square,
choose Use simulation time for the time, input 0.5 for the amplitude, input 0.1 for the frequency, and choose
rad/sec for the units.
D. The output of the Sum1 block is connected to the positive of the error (Sum block) block.
E. The output of the error block is connected to PID Controller block. Double – click the PID controller and select
“P” in the controller for the Proportional control. P(s) will appear in the block.
F. Click the arrow pointing downward of the VALVE subsystem. It has two inputs, 1 is control and 2 is source
flow. The control has a Limited Integrator subsystem, click the arrow again to view its components.
G. In_1 is connected to the second input of the Mux block, then its output is connected to Fcn block that has a
mathematical expression input of u[2]*((((u[1]>lb)+(u[2]>=0))>0)*(((u[1]<ub)+(u[2]<=0))>0)).
H. Fcn block is connected the Integrator block in which it outputs the value of the integral of its input signal with
respect to time. Then its output is connected to Out_1, then another line connected to the first input of Mux.
I. Going back to the VALVE subsystem, the Product block is multiplying Limited Integrator subsystem and the
source flow input. Its output is connected to the Outport (out_flow) block to link signals to its destination outside
of the system.
J. Back to the Model, there is a constant block (tank max inflow) that has a value of 0.5 connected to the source
flow of the VALVE subsystem.
K. The output of the VALVE subsystem is connected to another subsystem called WATER TANK. Click the arrow
to show its components.
L. The WATER TANK subsystem has one input and three outputs. Its Inport block (flow in) is connected to the
positive of the sum block. The sum block is connected to another subsystem tank volume.
M. The components of tank volume subsystem are the same with the Limited Integrator subsystem.
N. Then its connected with the Gain block that has a parameters: for Gain, input 1/area , then choose Element-
wise(K.*u) for multiplication.
O. Then its output is connected to a Fcn block with a mathematical expression of sqrt(2*9.8*u). Then its output is
connected to Gain block (outletArea), and connected to an Outport (change the port number to 2) block named
flow out.
P. Going back to the 1/area gain block, its connected to Outport (change the port number to 1) block and named it
water flow. The gain block is also connected to the Relay (Overflow sensor), and connected to Outport (change
the port number to 3) block named overflow flag.
Q. The three outputs of the WATER TANK subsystem have different paths. The overflow flag output is connected to
second input of Mux, and it is also connected to the negative of sum block (error). The water flow output is
connected to Scope 4. Then, the flow out output is connected to Scope 2.
R. The output of Mux is connected to a S-function block (animtank), also connected to comparison scope.
S. From the Library Browser, search “workspace” and select the To Workspace block twice.
T. Connect the first workspace block to the output of Sum1 block that is connected the Mux block, and rename it as
“TargetLevel”.
U. For the second workspace block, connect it the output of the WATER TANK, and rename it as “Actual”.

3. Simulate the Model

A. To simulate the model, input “100” (or in how many seconds you want to run it) in the Stop time and then click
the Run button.
B. There is a window of the Water Tank that will appear. It demonstrates the water being filled in the tank and
discharge from the tank.
C. Click Comparison scope to see the graph for “TargetLevel” and “Actual”.
D. The yellow line represents the “TargetLevel” block. To view its values in the graph, type “TargetLevel” in the
command window.
E. The blue line represents the “Actual” block. To view its values in the graph, type “Actual” in the command
window.
EXPERIMENT NO. 2
Proportional Plus Integral Control for The Temperature in A Heat Exchanger
OBJECTIVE:

1. To familiarize the student in using MATLAB Simulink.


2. To control the temperature in a heat exchanger using the Proportional Plus Integral Control (PI)
3. To be able to demonstrate the components of the model and simulate it.

THEORETICAL DISCUSSION:

Like the Proportional-Only Controller, the Proportional plus Integral (PI) algorithm computes and transmits a
controller output (CO) signal every sample time, T, to the final control element. The computed CO of the PI algorithm is
influenced by the controller tuning parameters and the controller error (e(t)).

There are two tuning parameters to adjust in the PI controllers which makes it more challenging to tune than a
Proportional-Only Controller but not as complex as the PID Controller.

Pi controllers can eliminate offset—a major weakness of a P controller because there is an integral action that
enables it. Thus, it provides a balance of complexity and capability that makes the PI Controllers the most widely used
algorithm in the process control operations.

Given that:

Where:

CO = controller output signal (the wire out)

CObias = controller bias or null value; set by bumpless transfer as explained below

e(t) = current controller error, defined as SP – PV

SP = set point

PV = measured process variable (the wire in)

Kc = controller gain, a tuning parameter

Ti = reset time, a tuning parameter

The first two terms on the right of the equal sign are identical to the P-only controller and the integral mode of the
controller is the last term of the equations. Hence, its function is to integrate or continuously add the controller error, e(t),
over time.
PROCESS:

Figure 1. Stirring Reactor with Heat Exchanger

In a heat exchanger, a chemical reactor called “stirring tank” is depicted in the figure above. The top inlet delivers
liquid which will be mixed in the tank. The liquid must be maintained at a constant temperature by varying the amount of
the steam supplied to the bottom pipe (heat exchanger) via control valve.

Variations in the temperature of the inlet flow are the main source of disturbances in the heat exchanger process.

REFERENCE:

1. https://www.mathworks.com/help/control/examples/temperature-control-in-a-heat-exchanger.html?s_tid=srchtitle

EQUIPMENT:

 MATLAB Simulink

PROCEDURE:

1. Start with Simulink


A. Click MATLAB icon on your desktop.
B. On the Menu, click the Simulink button and choose Blank model
C. Click the Library Browser, and in the search box, look the following components and right click Add block to
model untitled:
a. Constant
 Constant Value is 70
b. Scope
c. PID Controller
 Double click, change the controller to PI
d. Data Type Propagation
 Set to signal 1, 2 and 3
e. Add
f. Subtract
g. Step
 Step time: 20
 Final Value: -1
h. Subsystem (for Plant Disturbance Gd)

i. Subsystem (for Heat Exchanger Plant Gp)

Figure 2. Temperature Control in a Heat Exchanger

2. Components of the Model


A. Constant block (70) is connected to then positive terminal of th`e error block, and also connected to the signal
2 of the data type propagation.
B. Disturbance is directly connected to the Plant Disturbance Gd
C. Plant Disturbance Gd is connected to the positive terminal of Add block and connected to signal 1 of data
type propagation.
D. Error block is connected to the PI Controller.
E. PI Controller is connected to the Heat Exchanger Plant Gp.
F. Heat Exchanger Plant Gp is connected to the other positive terminal of Add block
G. Add block is connected to the negative terminal of the error block, and is connected to the Signal 3 of the data
type propagation block.
H. The data type propagation block is then connected to the scope.
3. Simulate the Model
A. Input the value of seconds you want to run in the Stop time and then click the Run button.
B. A window of a Heat exchanger will appear which will demonstrate the temperature control.
C. To stop and start the simulation, you can use the “Start” and “Stop” selection in the simulation pull-down
menu.

Figure 3. Heat Exchanger Simulation


EXPERIMENT NO. 3
Proportional Plus Derivative Control for The Temperature in A Heat
Exchanger

OBJECTIVE:
1. To familiarize the student in using MATLAB Simulink.
2. To control the temperature in a heat exchanger using the Proportional Plus Derivative Control (PD)
3. To be able to demonstrate the components of the model and simulate it.

THEORETICAL DISCUSSION:

Derivative controllers respond to the change in error with time. If the absolute value of error is rapidly
decreasing and the setpoint is near, it is likely that the setpoint will be reached and the error will change sign
and increase in the other direction. The derivative mode is useful in preventing this situation, especially in
systems with large time constants. Derivative response is usually measured in minutes; the time is a measure of
how far ahead the derivative + proportional action is ahead of the proportional action only in an open loop; the
higher this value, the greater the derivative action. Because a spike (a large but brief response in the measured
value) would cause a large action by the derivative mode, where no action is appropriate, the derivative mode is
not always appropriate. This is true with signals that are inherently noisy (such as flow rate measurements) or
systems wit long dead times. Sometimes the derivative mode is only used when a change in setpoint occurs. The
derivative mode is usually well suited for temperature measurements and control.

The proportional derivative controller produces an output, which is the combination of the outputs of
proportional and derivative controllers.

u(t)=KPe(t)+KDde(t)dt
Apply Laplace transform on both sides -
U(s)=(KP+KDs)E(s)
U(s)E(s)=KP+KDs
PROCESS:

Figure 1. Stirring Reactor with Heat Exchanger

In a heat exchanger, a chemical reactor called “stirring tank” is depicted in the figure above. The top
inlet delivers liquid which will be mixed in the tank. The liquid must be maintained at a constant temperature by
varying the amount of the steam supplied to the bottom pipe (heat exchanger) via control valve.
Variations in the temperature of the inlet flow are the main source of disturbances in the heat exchanger
process.

REFERENCE:
1. https://www.mathworks.com/help/control/examples/temperature-control-in-a-heatexchanger.html?
s_tid=srchtitle

EQUIPMENT:
 MATLAB Simulink

PROCEDURE:
1. Start with Simulink
A. Click MATLAB icon on your desktop.
B. On the Menu, click the Simulink button and choose Blank model
C. Click the Library Browser, and in the search box, look the following components and right click Add
block to model untitled:
a. Constant
• Constant Value is 70
b. Scope
c. PID Controller
• Double click, change the controller to PD
d. Data Type Propagation
• Set to signal 1, 2 and 3
e. Add
f. Subtract
g. Step
• Step time: 20
• Final Value: -1
h. Subsystem (for Plant Disturbance Gd)

i. Subsystem (for Heat Exchanger Plant Gp)

Figure 2. Temperature Control in a Heat Exchanger

2. Components of the Model

A. Constant block (70) is connected to then positive terminal of th`e error block, and also connected to
the signal 2 of the data type propagation.
B. Disturbance is directly connected to the Plant Disturbance Gd
C. Plant Disturbance Gd is connected to the positive terminal of Add block and connected to signal 1 of
data type propagation. D. Error block is connected to the PD Controller.
E. PI Controller is connected to the Heat Exchanger Plant Gp.
F. Heat Exchanger Plant Gp is connected to the other positive terminal of Add block
G. Add block is connected to the negative terminal of the error block, and is connected to the Signal 3
of the data type propagation block.
H. The data type propagation block is then connected to the scope.
3. Simulate the Model
A. Input the value of seconds you want to run in the Stop time and then click the Run button.
B. A window of a Heat exchanger will appear which will demonstrate the temperature control.
C. To stop and start the simulation, you can use the “Start” and “Stop” selection in the simulation pull-
down menu.

Figure 3. Heat Exchanger Simulation


EXPERIMENT NO. 4
Proportional plus Integral Control for Water Level in a Tank
Objective:
5. To control the water level in a tank using Proportional - Integral controller.
6. To demonstrate the components of the model and its subsystems.
7. To simulate the model.

Theoretical Discussion:
Proportional and Integral Controller is a combination of proportional and an integral controller the output (also
called the actuating signal) is equal to the summation of proportional and integral of the error signal. Now let us analyze
proportional and integral controller mathematically. As we know in a proportional and integral controller output is directly
proportional to the summation of proportional of error and integration of the error signal, writing this mathematically we
have,

e (t )=SP−PV (4.1)

Kc t
u ( t )=U bias + K c e ( t ) + ∫ e ( t ) dt (4.2)
τI 0

The Ubias term is a constant that is typically set to the value of u(t) when the controller is first switched from
manual to automatic mode. This gives "bumpless" transfer if the error is zero when the controller is turned on. The two
tuning values for a PI controller are the controller gain, K c and the integral time constant τ I. The value of Kc is a multiplier
on the proportional error and integral term and a higher value makes the controller more aggressive at responding to errors
away from the set point. The set point (SP) is the target value and process variable (PV) is the measured value that may
deviate from the desired value. The error from the set point is the difference between the SP and PV and is defined as
e(t)=SP−PV.

The higher the proportion coefficient, the less the output power at the same control error. The higher the
integration coefficient, the slower the accumulated integration coefficient. PI control provides zero control error
and is insensitive to interference of the measurement channel. The PI control disadvantage is slow reaction to
disturbances. To adjust the PI controller, you should first set the integration time equal to zero, and the
maximum proportion time. Then by decreasing the coefficient of proportionality, achieve periodic oscillations
in the system.
While the proportional term considers the current size of e(t) only at the time of the controller calculation, the
integral term considers the history of the error, or how long and how far the measured process variable has been
from the set point over time. Integration is a continual summing. Integration of error over time means that we
sum up the complete controller error history up to the present time, starting from when the controller was first
switched to automatic.

Reference/s:
https://www.mathworks.com/help/fuzzy/water-level-control-in-a-tank.html
https://blog.opticontrols.com/archives/344

Equipment:
• MATLAB Simulink

Procedure:
1. Getting Started with Simulink
E. To start MATLAB, click on the MATLAB icon on your desktop.
F. In the command window type “open_system(‘sltank’)”.
G. A Simulink window will open. The model of a Water Level Control in a Tank.
H. Remove Fuzzy Logic Controller block and everything that is connected to it (the block does not cover this topic).

Figure 1.1 Water Level Control Model with Proportional plus Integral Controller

2. Components of the Model

A. For the input of the Sum1 block, the constant block is connected to the positive, and the Signal Generator block is
connected to the negative.
B. Set the constant value of the Constant block to 1.
C. To set the parameters for the Signal Generator block, double – click the block and set the waveform to square,
choose Use simulation time for the time, input 0.5 for the amplitude, input 0.1 for the frequency, and choose
rad/sec for the units.
D. The output of the Sum1 block is connected to the positive of the error (Sum block) block.
E. The output of the error block is connected to PID Controller block. Double – click the PID controller and select
“PI” in the controller for the Proportional control. PI(s) will appear in the block.
F. Click the arrow pointing downward of the VALVE subsystem. It has two inputs, 1 is control and 2 is source
flow. The control has a Limited Integrator subsystem, click the arrow again to view its components.
G. In_1 is connected to the second input of the Mux block, then its output is connected to Fcn block that has a
mathematical expression input of u[2]*((((u[1]>lb)+(u[2]>=0))>0)*(((u[1]<ub)+(u[2]<=0))>0)).
H. Fcn block is connected the Integrator block in which it outputs the value of the integral of its input signal with
respect to time. Then its output is connected to Out_1, then another line connected to the first input of Mux.
I. Going back to the VALVE subsystem, the Product block is multiplying Limited Integrator subsystem and the
source flow input. Its output is connected to the Outport (out_flow) block to link signals to its destination outside
of the system.
J. Back to the Model, there is a constant block (tank max inflow) that has a value of 0.5 connected to the source
flow of the VALVE subsystem.
K. The output of the VALVE subsystem is connected to another subsystem called WATER TANK. Click the arrow
to show its components.
L. The WATER TANK subsystem has one input and three outputs. Its Inport block (flow in) is connected to the
positive of the sum block. The sum block is connected to another subsystem tank volume.
M. The components of tank volume subsystem are the same with the Limited Integrator subsystem.
N. Then its connected with the Gain block that has a parameters: for Gain, input 1/area , then choose Element-
wise(K.*u) for multiplication.
O. Then its output is connected to a Fcn block with a mathematical expression of sqrt(2*9.8*u). Then its output is
connected to Gain block (outletArea), and connected to an Outport (change the port number to 2) block named
flow out.
P. Going back to the 1/area gain block, its connected to Outport (change the port number to 1) block and named it
water flow. The gain block is also connected to the Relay (Overflow sensor), and connected to Outport (change
the port number to 3) block named overflow flag.
Q. The three outputs of the WATER TANK subsystem have different paths. The overflow flag output is connected to
second input of Mux, and it is also connected to the negative of sum block (error). The water flow output is
connected to Scope 4. Then, the flow out output is connected to Scope 2.
R. The output of Mux is connected to a S-function block (animtank), also connected to comparison scope.
S. From the Library Browser, search “workspace” and select the To Workspace block twice.
T. Connect the first workspace block to the output of Sum1 block that is connected the Mux block, and rename it as
“TargetLevel”.
U. For the second workspace block, connect it the output of the WATER TANK, and rename it as “Actual”.

3. Simulation of the Model

F. To simulate the model, input “100” (or in how many seconds you want to run it) in the Stop time and then click
the Run button.
G. There is a window of the Water Tank that will appear. It demonstrates the water being filled in the tank and
discharge from the tank.
H. Click Comparison scope to see the graph for “TargetLevel” and “Actual”.
I. The yellow line represents the “TargetLevel” block. To view its values in the graph, type “TargetLevel” in the
command window.
J. The blue line represents the “Actual” block. To view its values in the graph, type “Actual” in the command
window.
EXPERIMENT NO. 5
Proportional Plus Derivative for Water level in a Tank
Objective:
1. To familiarize the student in using MATLAB Simulink.
2. To control the water level in a tank using Proportional plus Derivative controller.
3. To demonstrate the components of the model and its subsystems.
4. To simulate the model.

Theoretical Discussion:
Derivative controllers respond to the change in error with time. If the absolute value of error is rapidly
decreasing and the setpoint is near, it is likely that the setpoint will be reached and the error will change sign
and increase in the other direction. The derivative mode is useful in preventing this situation, especially in
systems with large time constants. Derivative response is usually measured in minutes; the time is a measure of
how far ahead the derivative + proportional action is ahead of the proportional action only in an open loop; the
higher this value, the greater the derivative action. Because a spike (a large but brief response in the measured
value) would cause a large action by the derivative mode, where no action is appropriate, the derivative mode is
not always appropriate. This is true with signals that are inherently noisy (such as flow rate measurements) or
systems wit long dead times. Sometimes the derivative mode is only used when a change in setpoint occurs. The
derivative mode is usually well suited for temperature measurements and control.

The proportional derivative controller produces an output, which is the combination of the outputs of
proportional and derivative controllers.

u(t)=KPe(t)+KDde(t)dt
Apply Laplace transform on both sides -
U(s)=(KP+KDs)E(s)
U(s)E(s)=KP+KDs
Combined water tank systems are used in many resident areas. Most of the time they are functioning
well, but there is some condition that the system faces the problem of overflows because of the system cannot
detect whether the water level have properly reached the desired level or the flow-in rate of the water are not
proportional with the flow-out rate. It can cause the water tank system empties faster than it fills up.
Consequently, the pressure of the water cannot support the distribution of the water to the resident area.
Construction of new tank, valve or system could be the solution to completely eliminate the problems.
However, such schemes are expensive and can also be extremely disruptive because the system networks may
extend across wide geographical areas. Alternatively, controlling the flow between parts of the system which
are under different loading can reduce the overflow spills. Actuated valve can be opened or closed to control the
flow past a certain point.
Consider a cylindrical tank with no outlet flow and an adjustable inlet flow that is controlled by a valve.
The inlet flow rate is not measured but there is a level measurement that shows how much fluid has been added
to the tank. The objective of this exercise is to develop a controller that can maintain a certain water level by
automatically adjusting the inlet flow rate.

Reference/s:
https://www.mathworks.com/help/fuzzy/water-level-control-in-a-tank.html
https://whatis.techtarget.com/definition/proportional-control

Equipment:
• MATLAB Simulink
Procedure:
1. Getting Started with Simulink
A. To start MATLAB, click on the MATLAB icon on your desktop.
B. In the command window type “open_system(‘sltank’)”.
C. A Simulink window will open. The model of a Water Level Control in a Tank.
D. Remove Fuzzy Logic Controller block and everything that is connected to it (the block does not cover this topic).
Figure 1.1 Water Level Control Model

2. Components of the Model

A. For the input of the Sum1 block, the constant block is connected to the positive, and the Signal Generator block is
connected to the negative.
B. Set the constant value of the Constant block to 1.
C. To set the parameters for the Signal Generator block, double – click the block and set the waveform to square,
choose Use simulation time for the time, input 0.5 for the amplitude, input 0.1 for the frequency, and choose rad/
sec for the units.
D. The output of the Sum1 block is connected to the positive of the error (Sum block) block.
E. The output of the error block is connected to PID Controller block. Double – click the PID controller and select
“P” in the controller for the Proportional plus Dericative control. PD(s) will appear in the block.
F. Click the arrow pointing downward of the VALVE subsystem. It has two inputs, 1 is control and 2 is source
flow. The control has a Limited Integrator subsystem, click the arrow again to view its components.
G. In_1 is connected to the second input of the Mux block, then its output is connected to Fcn block that has a
mathematical expression input of u[2]*((((u[1]>lb)+(u[2]>=0))>0)*(((u[1]<ub)+(u[2]<=0))>0)).
H. Fcn block is connected the Integrator block in which it outputs the value of the integral of its input signal with
respect to time. Then its output is connected to Out_1, then another line connected to the first input of Mux.
I. Going back to the VALVE subsystem, the Product block is multiplying Limited Integrator subsystem and the
source flow input. Its output is connected to the Outport (out_flow) block to link signals to its destination outside
of the system.
J. Back to the Model, there is a constant block (tank max inflow) that has a value of 0.5 connected to the source
flow of the VALVE subsystem.
K. The output of the VALVE subsystem is connected to another subsystem called WATER TANK. Click the arrow
to show its components.
L. The WATER TANK subsystem has one input and three outputs. Its Inport block (flow in) is connected to the
positive of the sum block. The sum block is connected to another subsystem tank volume.
M. The components of tank volume subsystem are the same with the Limited Integrator subsystem.
N. Then its connected with the Gain block that has a parameters: for Gain, input 1/area , then choose
Elementwise(K.*u) for multiplication.
O. Then its output is connected to a Fcn block with a mathematical expression of sqrt(2*9.8*u). Then its output is
connected to Gain block (outletArea), and connected to an Outport (change the port number to 2) block named
flow out.
P. Going back to the 1/area gain block, its connected to Outport (change the port number to 1) block and named it
water flow. The gain block is also connected to the Relay (Overflow sensor), and connected to Outport (change
the port number to 3) block named overflow flag.
Q. The three outputs of the WATER TANK subsystem have different paths. The overflow flag output is connected to
second input of Mux, and it is also connected to the negative of sum block (error). The water flow output is
connected to Scope 4. Then, the flow out output is connected to Scope 2.
R. The output of Mux is connected to a S-function block (animtank), also connected to comparison scope.
S. From the Library Browser, search “workspace” and select the To Workspace block twice.
T. Connect the first workspace block to the output of Sum1 block that is connected the Mux block, and rename it as
“TargetLevel”.
U. For the second workspace block, connect it the output of the WATER TANK, and rename it as “Actual”.

3. Simulate the Model

A. To simulate the model, input “100” (or in how many seconds you want to run it) in the Stop time and then click
the Run button.
B. There is a window of the Water Tank that will appear. It demonstrates the water being filled in the tank and
discharge from the tank.
C. Click Comparison scope to see the graph for “TargetLevel” and “Actual”.
D. The yellow line represents the “TargetLevel” block. To view its values in the graph, type “TargetLevel” in the
command window.
E. The blue line represents the “Actual” block. To view its values in the graph, type “Actual” in the command
window.

EXPERIMENT NO. 6
PID Control for Water level in a
Tank
Objective:
1. To control the water level in a tank using PID Control
2. To simulate the model.

Theoretical Discussion:
Proportional or P- controller gives output which is proportional to current error e (t). It compares desired or set
point with actual value or feedback process value. The resulting error is multiplied with proportional constant to get the
output. If the error value is zero, then this controller output is zero. Due to limitation of controller where there always
exists an offset between the process variable and set point, I-controller is needed, which provides necessary action to
eliminate the steady state error. It integrates the error over a period of time until error value reaches to zero. It holds the
value to final control device at which error becomes zero. Integral control decreases its output when negative error takes
place. It limits the speed of response and affects stability of the system. Speed of the response is increased by decreasing
integral gain Ki. I-controller doesn’t have the capability to predict the future behavior of error. So, it reacts normally once
the set point is changed. D controller overcomes this problem by anticipating future behavior of the error. Its output
depends on rate of change of error with respect to time, multiplied by derivative constant. It gives the kick start for the
output thereby increasing system response. [1]

Figure 6.1 Block diagram of a basic PID control [1]

Combining all three modes of control (proportional, integral and derivative) enables a controller to be produced
which has no steady state error and reduces the tendency for oscillations. Such a controller is known as a three-mode
controller or PID controller. The equation describing its action is:

𝐶𝑜𝑛𝑡𝑟𝑜𝑙𝑙𝑒𝑟 𝑜𝑢𝑡𝑝𝑢𝑡 = 𝐾𝑝(𝑒𝑟𝑟𝑜𝑟) + 𝐾1(𝑖𝑛𝑡𝑒𝑔𝑟𝑎𝑙 𝑜𝑓 𝑒𝑟𝑟𝑜𝑟) + 𝐾𝐷(𝑟𝑎𝑡𝑒 𝑜𝑓 𝑐ℎ𝑎𝑛𝑔𝑒 𝑜𝑓 𝑒𝑟𝑟𝑜𝑟) (6.1)

where Kp is the proportionality constant, K1 the integral constant and KD the derivative constant. A PID
controller can be considered to be a proportional controller which has integral control to eliminate the offset error
and derivative control to reduce time lags. [2]

Fi

Figure 6.2 Proportional Plus Integral Plus Derivative Control Action [3]

Finally, the full three-mode controller is achieved by combining the three modes (Proportional + Integral +
Derivative) simultaneously, Thus the valve position will be determined by adding the effects of the three modes. The
graph in Figure 6.2 illustrates how an increase in the flow of the liquid to be heated will be responded to by the various
control modes in terms of the process variable, and liquid output temperature.
Equipment:
• MATLAB Simulink
Results and Discussion

Figure 6.3 MATLAB-Simulink model of the liquid level control system with PID controller and step response of the
system.

MATLAB simulations were done to study the performance of the system and its capability to maintain and
control a desired water level in the tank. Since the PID controller is integrated in MATLAB, it is easy to simulate the
system and observe the results for different values of Kp, Ki and Kd parameters of the controller. An optimum or
acceptable result can be obtained by tuning the parameters until the design requirements are met. For this study, we
assumed the following parameter values for the motor, the tank, and the STH system.
• Motor: -J = 0.01 Kg.m2, b = 0.1 N.m.s, Kt = 0.1 N.m/A, Ke=0.01 V/rad/s, R = 1 Ω, L = 0.5 H.
• Tank: -A=0.5 m2, Rf =0.5 s/m2
• STH: -Kf =1
Furthermore, for a unit step input reference water level for the overall system, our design criteria are to achieve an
output with a settling time less than 2 seconds an overshoot less than 5% and a steady-state error less than 1%.

Fig. 6.4 shows the system response with and without proportional controller. As seen in the Figure, the results
without the PID controller (red color) is simply the step response of the DC motor combined with the STH block. The
performance without controller is very poor in terms of settling time with very high steady state error and a final value 50
% of the required reference target. It shows the requirement of a controller to obtain the desired water or liquid level. The
proportional controller reduces the rise time, improves the steady state error to some extent but a ringing and an overshoot
starts to appear. A proportional controller with Kp=10 looks better in terms of reducing the steady state error compared
with Kp=5. For Kp=10, the settling time is about 2.95 s, an overshoot of 47%, and steady state value of 0.83. The high
overshoot, settling time and steady state error necessitate the requirement of integral and derivative part to be added in the
controller as not all of the design requirements can be met with a simple proportional controller.
Figure 6.4 Step response with and without proportional controller

Fig. 6.5 shows the system response with the proportionalintegral (PI) controller with Kp=Ki=10. The addition of
the integral part to the proportional part eliminates the steady state error getting a final value near the required level
compared with the Fig. 6.4. However, there is still a high overshoot and the settling time is also getting large.

Figure 6.5 Step response with proportional-integral (PI) controller

The other variety of controller is the proportional-derivative (PD) controller. Fig. 6.6 shows the system step
response with the PD controller with Kp=10 and Kd=5. It reduces the over shoot, improves the rise time and settling time
but with a significant amount of steady state error. The final value is still not close to the desired level.
Figure 6.6 Step response with proportional-derivative (PD) controller

Fig. 6.7 shows the proportional-integral and derivative (PID) controller with Kp=12, Ki=15 and Kd=3. In this case
the initial design specifications are met with overshoot less than 5%, settling time less than 2 seconds and steady state
value of one, which is the required water level specifications. In this case, the rise time is also reduced. Therefore, with
the PID controller, the desired design target is achieved. Furthermore, as shown in Fig. 6.8, the overshoot can be reduced
at the expense of a slight increase in the settling time for the PID controller with Kp=9, Ki=15 and Kd=2.

Figure 6.7 Step response with proportional-integral derivative (PID) controller (Kp=12, Ki=15, Kd=3).

Fig. 6.9 shows all the controllers plotted in one graph in order to have better visualization of their performances
and clearly showing the super-performance of the PID controller compared with the others. With such PID controlled
system, the water level can be controlled continuously without the need of manual operation, which saves time and
manpower from automation. The PID controller automatically responds to the system so that the system is stabilized near
the desired set point.
Figure 6.8 Step response with proportional-integral derivative (PID) controller (Kp=9, Ki=15, Kd=2).

Figure 6.9 Step response showing the uncontrolled system, the proportional, the PI, PD and the PID controllers in one
plot

Table I shows a comparison of the different controllers in terms of rise time, settling time, overshoot and steady
state values. From the table, we observe that a proportional controller tends to reduce the rise time and settling time but
never eliminate the steady state error. There is also a large overshoot. A proportional-integral (PI)controller has the effect
of eliminating the steady state error with the final value achieving the desired reference input but it makes the transient
response worse with larger overshoot and also large settling time. A proportional-derivative (PD) controller has the effect
of increasing the stability of the system by reducing the overshoot, the rise time, the settling time and overall improves the
transient response. However, there is still large steady state error. The proportional-integral derivative (PID) controller
performs well in all the parameters and satisfies the design requirements. Therefore, it is possible to fulfill the design
requirements and obtain optimum performance with good accuracy by carefully tuning and selecting the proper values for
Kp, Ki and Kd.
TABLE I. COMPARISON OF THE DIFFERENT CONTROLLERS

Type of Performance parameters


controller
Rise Settlin Oversho Steady
time g time ot (%) state
(s) (s) value
Proportional 0.228 2.95 47.2 0.832
(P), Kp=10
PI, Kp=10, 0.237 4.64 49.2 1.0
Ki=10
PD, Kp=10, 0.1 0.537 20.5 0.832
Kd=5
PID, Kp=12, 0.17 0.81 4.45 1.0
Ki=15, Kd=3
PID, Kp=9, 0.233 1.39 3.24 1.0
Ki=15, Kd=2

Conclusion
This paper presents a PID controlled water pump system in order to maintain a desired water level in a storage
tank that is used in private, chemical, industrial or other related applications. The speed of the motor and hence the rate of
water flow into the tank is controlled by adjusting the parameters of the PID controller. A step reference water level is set
and the step response of the overall system is investigated in MATLAB environment in order to minimize the overshoot,
improve the settling time (improved transient response) and the steady state error of the system. Various forms of the
controller, P, PI, PD, and PID are studied and the PID controller achieves super performance. It is shown that suitable
values for Kp, Ki, Kd parameters can be found for the PID controller by tuning to maintain the desired water level for the
target design specifications. The system is essential in those places where maintaining water or any other liquid level is
critical for achieving the required productivity. Such controllers are powerful in controlling any similar processes that
essentially require close monitoring (tight control) of the process variables or parameters that have significant impact on
quality and amount of production.

References
1. http://blog.opticontrols.com/archives/344
2. https://circuitdigest.com/article/what-is-pid-controller-working-structure-applications
3. https://www.scribd.com/document/250148992/Basic-Instrumentation-Process-Control
4. https://aurak.ac.ae/publications/Water-Level-Controlling-System-Using-Pid-Controller.pdf
EXPERIMENT 7
PID CONTROL FOR THE TEMPERATURE IN A HEAT EXCHANGER
Objectives:

1. Familiarize with the concept and advantages of PID controller in a heat exchanger.
2. To regulate the temperature of the outgoing fluid of a heat exchanger system to a desired temperature.

Theoretical Discussion:

Heat exchanger system is widely used in chemical plants because it can sustain wide range of temperature and
pressure. The main purpose of a heat exchanger system is to transfer heat from a hot fluid to a cooler fluid, so temperature
control of outlet fluid is of prime importance. To control the temperature of outlet fluid of the heat exchanger system a
conventional PID controller can be used. Due to inherent disadvantages of conventional control techniques, model-based
control technique is employed and an internal model based PID controller is developed to control the temperature of outlet
fluid of the heat exchanger system.

A chemical reactor called "stirring tank" is depicted below. The top inlet delivers liquid to be mixed in the tank.
The tank liquid must be maintained at a constant temperature by varying the amount of steam supplied to the heat
exchanger (bottom pipe) via its control valve. Variations in the temperature of the inlet flow are the main source of
disturbances in this process.

Stirring Reactor with Heat Exchanger

To maintain the outlet temperature at the desired set-point, a high-order outlet temperature control model is established for
a shell-and–tube heat exchanger, which is based on the analysis of its heat transfer process and dynamic properties .The
Optimal PID control is applied to the temperature control system on the basis of this model, and the tuning parameters of
the PID controller are obtained by numerical solving of a formulated optimization problem using MATLAB/Simulink.
From the experimental data, the transfer functions and gains are obtained as below:

50𝑒−𝑠𝑇𝑑
Transfer Function of Process:
30𝑠+1

Gain of Valve = 0.13

Transfer Function of Valve:

In feedback control scheme the sensor detects the process output and gives the error to the controller, which in
turn takes appropriate controlling action. But till the controlling action reaches the process, the output has been changed.
So, a feed forward controller along with the feedback controller has been implemented. A feed forward control estimates
the error and changes the manipulating variable before the disturbance can affect the output. To further minimize the
overshoot a feed-forward controller is introduced in the forward path of the process along with the feedback controller.
The combined effect of feedback and feedforward controller reduces the overshoot value.

Fee
d-forward and Feedback Control Block Diagram of Heat Exchanger System

The mnemonic PID refers to the first letters of the names of the individual terms that make up the standard three
term controller. These are P for the proportional term, I for the integral term and D for the derivative term in the
controller. PID controllers are probably the most widely used industrial controller. Even complex industrial control
systems may comprise a control network whose main control building block is a PID control module. In PID controller
Proportional (P) control is not able to remove steady state error or offset error in step response. This offset can be
eliminated by Integral (I) control action. Output of I controller at any instant is the area under actuating error signal curve
up to that instant. I control removes offset, but may lead to oscillatory response of slowly decreasing amplitude or even
increasing amplitude, both of which are undesirable. Derivative (D) control action has high sensitivity. It anticipates
actuating error, initiates an early correction action and tends to increase stability of system.

Ideal PID controller in continuous time is given as:


y ( t ) =K p ¿

Laplace domain representation of ideal PID controller is:

Y (s) 1
Gc ( s )=
E(s) (
=K p 1+
T is
+ Td s )
Equipment Used:

• MATLAB SIMULINK 2019b

Procedure:

1. Start MATLAB, and go to Simulink.


2. Open a new Simulink model window from FILE → NEW → MODEL.
3. To derive a first-order-plus-deadtime model of the heat exchanger characteristics, inject a step disturbance in
valve voltage V and record the effect on the tank temperature T over time.
4. In the command window type,
“heatex_plotdata
title('Measured response to step change in steam valve voltage');”
5. The values t1 and t2 are the times at set value.
6. Set time responses at 28.3% and 63.2%, these values will estimate the time constant and dead time for the heat
exchanger.
Time constant = tau
Dead time = theta

7. Input,
“t1 = 21.8; t2 = 36.0;
tau = 3/2 * ( t2 - t1 )
theta = t2 – tau”
8. The values are: tau = 21.3000 and theta = 14.7000
Measured Response to Step Change in Steam Valve Voltage

9. Recall that changes in inflow temperature are the main source of temperature fluctuations in the tank. To reject
such disturbances, an alternative to feedback control is the feedforward system:

Note: In this configuration, the feedforward controller F uses measurements of the inflow temperature to adjust the
steam valve opening (voltage V). Feedforward control thus anticipates and preempts the effect of inflow temperature
changes.

10. Increase the ideal feedforward delay by 5 seconds and simulate the response to a step change in inflow
temperature,
Gd = exp(-35*s)/(25*s+1);
F = -(21.3*s+1)/(25*s+1) * exp(-25*s); Tff = Gp * ss(F) +
Gd; step(Tff), grid
title(‘the effect of disturbance in inflow temperature') ylabel('Tank temperature')

You might also like