index [mgdic.files.wordpress.com] · 2019-12-16 · isp(3341705) ic dept gp,gandhinagar page 1...
TRANSCRIPT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 1
INDEX
Subject Code ISP (3341705) Enrol No _________________
SR NO
PRACTICAL EXPERIMENTS
DATE
SIGN
1 Install process and control instrumentation Simulating and
Analyzing softwares and familiarize with the system
requirements and essential featuresspecifications of the
software in use
2 Develop mathematical model for a single process parameter of a tank system
3 Simulate a simple feedback loop for process parameter and obtain output varying set point
4 Determine poles and zeros of given first order transfer function
5 Obtain poles and zeros of given second order transfer function
6 Simulate P -control action on a given system for given stepramp input and set point Obtain the effect on output varying Kp of the system
7 Simulate I -control action on a given system for given stepramp input and set point Obtain the effect on output varying Ki of the system
8 Simulate P+I -control action on a given system for given stepramp input and set point Obtain the effect on output varying Kp and Ki of the system
9 Simulate P+D -control action on a given system for given stepramp input and set point Obtain the effect on output varying Kp and Kd of the system
10 Simulate P+I+D -control action on a given system for given stepramp input and set point Obtain the effect on output varying Kp Kd and Ki of the system
11 Simulate a simple feed forward loop for process parameter and obtain output varying set point
12 Simulate a simple cascade loop for process parameter
13 Simulate a simple ratio control for process parameter and obtain output varying set point
14 Simulate non interacting level system using process control simulator
15 Simulate interacting level system using process control simulator
16 Simulate On-Off LEVEL control system using process control simulator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 2
17 To convert 10-degree celsius into fahrenheit using LABVIEW
18 Simulate three element boiler control system
19 Practice exercise-1
20 Practice exercise-2
21 Practice exercise-3
22 Practice exercise-4
23 Practice exercise-5
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 3
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 4
PRACTICAL-1 Aim Install process and control instrumentation Simulating and Analysing software and
familiarize with the system requirements and essential featuresspecifications of the
software in use
SOFTWARE REQUIRED
bull MATLAB R2012a
INSTALLING PROCEDURE
Step 1 Start the Installer Step 2 Choose Whether to Install Using the Internet Step 3 Review the Software License Agreement Step 4 Log In to Your MathWorks Account Step 5 Select the License You Want to Install Step 6 Choose the Installation Type Step 7 Specify the Installation Folder Step 8 Specify Products to Install (Custom Only) Step 9 Specify Installation Options (Custom Only) Step 10 Confirm Your Choices Step 11 Complete the Installation
INTRODUCTION MATLAB which stands for MATrix LABoratory is a technical computing environment for high-performance numeric computation and visualization SIMULINK is a part of MATLAB that can be used to simulate dynamic systems Starting and Quitting MATLAB To start MATLAB click on the MATLAB icon or type in MATLAB followed by pressing the enter The screen will produce the MATLAB prompt gtgt which indicates that MATLAB is waiting for a command to be entered In order to quit MATLAB type quit or exit after the prompt followed by pressing the enter or return key Display Windows MATLAB has three display windows They are 1 A Command Window which is used to enter commands 2 A Graphics Window which is used to display plots and graphs 3 An Edit Window which is used to create and modify M-files M-files are files that contain a program or script of MATLAB commands Entering Commands MATLAB commands are case sensitive and lower case letters are used throughout To execute an M-file (such as Project_1m) simply enter the name of the file without its extension (as in Project_1)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 5
The Semicolon () If a semicolon () is typed at the end of a command the output of the command is not displayed Typing When percent symbol () is typed in the beginning of a line the line is designated as a comment When the enter key is pressed the line is not executed The clc Command Typing clc command and pressing enter cleans the command window Once the clc command is executed a clear window is displayed Help MATLAB has a host of built-in functions For a complete list refer to MATLAB userrsquos guide or refer to the on line Help Statements and Variables Statements have the form gtgt variable = expression The equals (ldquo=rdquo) sign implies the assignment of the expression to the variable
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 6
MATLAB BASICS 1 Start Matlab and then the Simulink environment by typing simulink to the matlab prompter
2 Open a new Simulink model window from File 1048774 New 1048774 Model
3 You can construct your block diagram by drag-and-dropping the appropriate blocks from the main Simulink windows
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 7
4 Start the simulation You can see the graph on scope screen
ESSENTIAL FEATURESSPECIFICATIONS OF THE SOFTWARE
bull High-level language for numerical computation visualization and application development
bull Interactive environment for iterative exploration design and problem solving
bull Mathematical functions for linear algebra statistics Fourier analysis filtering optimization numerical integration and solving ordinary differential equations
bull Built-in graphics for visualizing data and tools for creating custom plots
bull Development tools for improving code quality and maintainability and maximizing performance
bull Tools for building applications with custom graphical interfaces
Conclusion From this practical we can learn installing procedure of process and control instrumentation Simulating and Analyzing software and its features
Question bank
1) Give the full form of Matlab
2) Give the name of Simulating and Analysing softwares
3) which indicates that MATLAB is waiting for a command to be entered a) gtgt b) clc c) d) ^ 4) Which command is used for clear screen 5) Matlab has Built-in graphics for visualizing data and tools for creating custom plots True or False
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 8
PRACTICAL 2
Aim Develop mathematical model for a single process parameter of a tank system
Tank system Parameters
Height of tank
024m Maximum
fill level 02m
Radius of
tank0105m
Tank capacity volume 00069237m3
Figure 1 Fig shows process model Figure 2 Fig shows level sensor probe
Liquid
inflow qi(t)
Liquid
outflow
qo(t) Height
outflow h
Area A
Rate of change of volume = inflow -outflow
119889119907
119889119905= 119902119894(119905) minus 1199020(119905)
Now volume = area x height
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 2
17 To convert 10-degree celsius into fahrenheit using LABVIEW
18 Simulate three element boiler control system
19 Practice exercise-1
20 Practice exercise-2
21 Practice exercise-3
22 Practice exercise-4
23 Practice exercise-5
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 3
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 4
PRACTICAL-1 Aim Install process and control instrumentation Simulating and Analysing software and
familiarize with the system requirements and essential featuresspecifications of the
software in use
SOFTWARE REQUIRED
bull MATLAB R2012a
INSTALLING PROCEDURE
Step 1 Start the Installer Step 2 Choose Whether to Install Using the Internet Step 3 Review the Software License Agreement Step 4 Log In to Your MathWorks Account Step 5 Select the License You Want to Install Step 6 Choose the Installation Type Step 7 Specify the Installation Folder Step 8 Specify Products to Install (Custom Only) Step 9 Specify Installation Options (Custom Only) Step 10 Confirm Your Choices Step 11 Complete the Installation
INTRODUCTION MATLAB which stands for MATrix LABoratory is a technical computing environment for high-performance numeric computation and visualization SIMULINK is a part of MATLAB that can be used to simulate dynamic systems Starting and Quitting MATLAB To start MATLAB click on the MATLAB icon or type in MATLAB followed by pressing the enter The screen will produce the MATLAB prompt gtgt which indicates that MATLAB is waiting for a command to be entered In order to quit MATLAB type quit or exit after the prompt followed by pressing the enter or return key Display Windows MATLAB has three display windows They are 1 A Command Window which is used to enter commands 2 A Graphics Window which is used to display plots and graphs 3 An Edit Window which is used to create and modify M-files M-files are files that contain a program or script of MATLAB commands Entering Commands MATLAB commands are case sensitive and lower case letters are used throughout To execute an M-file (such as Project_1m) simply enter the name of the file without its extension (as in Project_1)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 5
The Semicolon () If a semicolon () is typed at the end of a command the output of the command is not displayed Typing When percent symbol () is typed in the beginning of a line the line is designated as a comment When the enter key is pressed the line is not executed The clc Command Typing clc command and pressing enter cleans the command window Once the clc command is executed a clear window is displayed Help MATLAB has a host of built-in functions For a complete list refer to MATLAB userrsquos guide or refer to the on line Help Statements and Variables Statements have the form gtgt variable = expression The equals (ldquo=rdquo) sign implies the assignment of the expression to the variable
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 6
MATLAB BASICS 1 Start Matlab and then the Simulink environment by typing simulink to the matlab prompter
2 Open a new Simulink model window from File 1048774 New 1048774 Model
3 You can construct your block diagram by drag-and-dropping the appropriate blocks from the main Simulink windows
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 7
4 Start the simulation You can see the graph on scope screen
ESSENTIAL FEATURESSPECIFICATIONS OF THE SOFTWARE
bull High-level language for numerical computation visualization and application development
bull Interactive environment for iterative exploration design and problem solving
bull Mathematical functions for linear algebra statistics Fourier analysis filtering optimization numerical integration and solving ordinary differential equations
bull Built-in graphics for visualizing data and tools for creating custom plots
bull Development tools for improving code quality and maintainability and maximizing performance
bull Tools for building applications with custom graphical interfaces
Conclusion From this practical we can learn installing procedure of process and control instrumentation Simulating and Analyzing software and its features
Question bank
1) Give the full form of Matlab
2) Give the name of Simulating and Analysing softwares
3) which indicates that MATLAB is waiting for a command to be entered a) gtgt b) clc c) d) ^ 4) Which command is used for clear screen 5) Matlab has Built-in graphics for visualizing data and tools for creating custom plots True or False
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 8
PRACTICAL 2
Aim Develop mathematical model for a single process parameter of a tank system
Tank system Parameters
Height of tank
024m Maximum
fill level 02m
Radius of
tank0105m
Tank capacity volume 00069237m3
Figure 1 Fig shows process model Figure 2 Fig shows level sensor probe
Liquid
inflow qi(t)
Liquid
outflow
qo(t) Height
outflow h
Area A
Rate of change of volume = inflow -outflow
119889119907
119889119905= 119902119894(119905) minus 1199020(119905)
Now volume = area x height
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 3
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 4
PRACTICAL-1 Aim Install process and control instrumentation Simulating and Analysing software and
familiarize with the system requirements and essential featuresspecifications of the
software in use
SOFTWARE REQUIRED
bull MATLAB R2012a
INSTALLING PROCEDURE
Step 1 Start the Installer Step 2 Choose Whether to Install Using the Internet Step 3 Review the Software License Agreement Step 4 Log In to Your MathWorks Account Step 5 Select the License You Want to Install Step 6 Choose the Installation Type Step 7 Specify the Installation Folder Step 8 Specify Products to Install (Custom Only) Step 9 Specify Installation Options (Custom Only) Step 10 Confirm Your Choices Step 11 Complete the Installation
INTRODUCTION MATLAB which stands for MATrix LABoratory is a technical computing environment for high-performance numeric computation and visualization SIMULINK is a part of MATLAB that can be used to simulate dynamic systems Starting and Quitting MATLAB To start MATLAB click on the MATLAB icon or type in MATLAB followed by pressing the enter The screen will produce the MATLAB prompt gtgt which indicates that MATLAB is waiting for a command to be entered In order to quit MATLAB type quit or exit after the prompt followed by pressing the enter or return key Display Windows MATLAB has three display windows They are 1 A Command Window which is used to enter commands 2 A Graphics Window which is used to display plots and graphs 3 An Edit Window which is used to create and modify M-files M-files are files that contain a program or script of MATLAB commands Entering Commands MATLAB commands are case sensitive and lower case letters are used throughout To execute an M-file (such as Project_1m) simply enter the name of the file without its extension (as in Project_1)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 5
The Semicolon () If a semicolon () is typed at the end of a command the output of the command is not displayed Typing When percent symbol () is typed in the beginning of a line the line is designated as a comment When the enter key is pressed the line is not executed The clc Command Typing clc command and pressing enter cleans the command window Once the clc command is executed a clear window is displayed Help MATLAB has a host of built-in functions For a complete list refer to MATLAB userrsquos guide or refer to the on line Help Statements and Variables Statements have the form gtgt variable = expression The equals (ldquo=rdquo) sign implies the assignment of the expression to the variable
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 6
MATLAB BASICS 1 Start Matlab and then the Simulink environment by typing simulink to the matlab prompter
2 Open a new Simulink model window from File 1048774 New 1048774 Model
3 You can construct your block diagram by drag-and-dropping the appropriate blocks from the main Simulink windows
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 7
4 Start the simulation You can see the graph on scope screen
ESSENTIAL FEATURESSPECIFICATIONS OF THE SOFTWARE
bull High-level language for numerical computation visualization and application development
bull Interactive environment for iterative exploration design and problem solving
bull Mathematical functions for linear algebra statistics Fourier analysis filtering optimization numerical integration and solving ordinary differential equations
bull Built-in graphics for visualizing data and tools for creating custom plots
bull Development tools for improving code quality and maintainability and maximizing performance
bull Tools for building applications with custom graphical interfaces
Conclusion From this practical we can learn installing procedure of process and control instrumentation Simulating and Analyzing software and its features
Question bank
1) Give the full form of Matlab
2) Give the name of Simulating and Analysing softwares
3) which indicates that MATLAB is waiting for a command to be entered a) gtgt b) clc c) d) ^ 4) Which command is used for clear screen 5) Matlab has Built-in graphics for visualizing data and tools for creating custom plots True or False
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 8
PRACTICAL 2
Aim Develop mathematical model for a single process parameter of a tank system
Tank system Parameters
Height of tank
024m Maximum
fill level 02m
Radius of
tank0105m
Tank capacity volume 00069237m3
Figure 1 Fig shows process model Figure 2 Fig shows level sensor probe
Liquid
inflow qi(t)
Liquid
outflow
qo(t) Height
outflow h
Area A
Rate of change of volume = inflow -outflow
119889119907
119889119905= 119902119894(119905) minus 1199020(119905)
Now volume = area x height
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 4
PRACTICAL-1 Aim Install process and control instrumentation Simulating and Analysing software and
familiarize with the system requirements and essential featuresspecifications of the
software in use
SOFTWARE REQUIRED
bull MATLAB R2012a
INSTALLING PROCEDURE
Step 1 Start the Installer Step 2 Choose Whether to Install Using the Internet Step 3 Review the Software License Agreement Step 4 Log In to Your MathWorks Account Step 5 Select the License You Want to Install Step 6 Choose the Installation Type Step 7 Specify the Installation Folder Step 8 Specify Products to Install (Custom Only) Step 9 Specify Installation Options (Custom Only) Step 10 Confirm Your Choices Step 11 Complete the Installation
INTRODUCTION MATLAB which stands for MATrix LABoratory is a technical computing environment for high-performance numeric computation and visualization SIMULINK is a part of MATLAB that can be used to simulate dynamic systems Starting and Quitting MATLAB To start MATLAB click on the MATLAB icon or type in MATLAB followed by pressing the enter The screen will produce the MATLAB prompt gtgt which indicates that MATLAB is waiting for a command to be entered In order to quit MATLAB type quit or exit after the prompt followed by pressing the enter or return key Display Windows MATLAB has three display windows They are 1 A Command Window which is used to enter commands 2 A Graphics Window which is used to display plots and graphs 3 An Edit Window which is used to create and modify M-files M-files are files that contain a program or script of MATLAB commands Entering Commands MATLAB commands are case sensitive and lower case letters are used throughout To execute an M-file (such as Project_1m) simply enter the name of the file without its extension (as in Project_1)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 5
The Semicolon () If a semicolon () is typed at the end of a command the output of the command is not displayed Typing When percent symbol () is typed in the beginning of a line the line is designated as a comment When the enter key is pressed the line is not executed The clc Command Typing clc command and pressing enter cleans the command window Once the clc command is executed a clear window is displayed Help MATLAB has a host of built-in functions For a complete list refer to MATLAB userrsquos guide or refer to the on line Help Statements and Variables Statements have the form gtgt variable = expression The equals (ldquo=rdquo) sign implies the assignment of the expression to the variable
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 6
MATLAB BASICS 1 Start Matlab and then the Simulink environment by typing simulink to the matlab prompter
2 Open a new Simulink model window from File 1048774 New 1048774 Model
3 You can construct your block diagram by drag-and-dropping the appropriate blocks from the main Simulink windows
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 7
4 Start the simulation You can see the graph on scope screen
ESSENTIAL FEATURESSPECIFICATIONS OF THE SOFTWARE
bull High-level language for numerical computation visualization and application development
bull Interactive environment for iterative exploration design and problem solving
bull Mathematical functions for linear algebra statistics Fourier analysis filtering optimization numerical integration and solving ordinary differential equations
bull Built-in graphics for visualizing data and tools for creating custom plots
bull Development tools for improving code quality and maintainability and maximizing performance
bull Tools for building applications with custom graphical interfaces
Conclusion From this practical we can learn installing procedure of process and control instrumentation Simulating and Analyzing software and its features
Question bank
1) Give the full form of Matlab
2) Give the name of Simulating and Analysing softwares
3) which indicates that MATLAB is waiting for a command to be entered a) gtgt b) clc c) d) ^ 4) Which command is used for clear screen 5) Matlab has Built-in graphics for visualizing data and tools for creating custom plots True or False
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 8
PRACTICAL 2
Aim Develop mathematical model for a single process parameter of a tank system
Tank system Parameters
Height of tank
024m Maximum
fill level 02m
Radius of
tank0105m
Tank capacity volume 00069237m3
Figure 1 Fig shows process model Figure 2 Fig shows level sensor probe
Liquid
inflow qi(t)
Liquid
outflow
qo(t) Height
outflow h
Area A
Rate of change of volume = inflow -outflow
119889119907
119889119905= 119902119894(119905) minus 1199020(119905)
Now volume = area x height
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 5
The Semicolon () If a semicolon () is typed at the end of a command the output of the command is not displayed Typing When percent symbol () is typed in the beginning of a line the line is designated as a comment When the enter key is pressed the line is not executed The clc Command Typing clc command and pressing enter cleans the command window Once the clc command is executed a clear window is displayed Help MATLAB has a host of built-in functions For a complete list refer to MATLAB userrsquos guide or refer to the on line Help Statements and Variables Statements have the form gtgt variable = expression The equals (ldquo=rdquo) sign implies the assignment of the expression to the variable
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 6
MATLAB BASICS 1 Start Matlab and then the Simulink environment by typing simulink to the matlab prompter
2 Open a new Simulink model window from File 1048774 New 1048774 Model
3 You can construct your block diagram by drag-and-dropping the appropriate blocks from the main Simulink windows
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 7
4 Start the simulation You can see the graph on scope screen
ESSENTIAL FEATURESSPECIFICATIONS OF THE SOFTWARE
bull High-level language for numerical computation visualization and application development
bull Interactive environment for iterative exploration design and problem solving
bull Mathematical functions for linear algebra statistics Fourier analysis filtering optimization numerical integration and solving ordinary differential equations
bull Built-in graphics for visualizing data and tools for creating custom plots
bull Development tools for improving code quality and maintainability and maximizing performance
bull Tools for building applications with custom graphical interfaces
Conclusion From this practical we can learn installing procedure of process and control instrumentation Simulating and Analyzing software and its features
Question bank
1) Give the full form of Matlab
2) Give the name of Simulating and Analysing softwares
3) which indicates that MATLAB is waiting for a command to be entered a) gtgt b) clc c) d) ^ 4) Which command is used for clear screen 5) Matlab has Built-in graphics for visualizing data and tools for creating custom plots True or False
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 8
PRACTICAL 2
Aim Develop mathematical model for a single process parameter of a tank system
Tank system Parameters
Height of tank
024m Maximum
fill level 02m
Radius of
tank0105m
Tank capacity volume 00069237m3
Figure 1 Fig shows process model Figure 2 Fig shows level sensor probe
Liquid
inflow qi(t)
Liquid
outflow
qo(t) Height
outflow h
Area A
Rate of change of volume = inflow -outflow
119889119907
119889119905= 119902119894(119905) minus 1199020(119905)
Now volume = area x height
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 6
MATLAB BASICS 1 Start Matlab and then the Simulink environment by typing simulink to the matlab prompter
2 Open a new Simulink model window from File 1048774 New 1048774 Model
3 You can construct your block diagram by drag-and-dropping the appropriate blocks from the main Simulink windows
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 7
4 Start the simulation You can see the graph on scope screen
ESSENTIAL FEATURESSPECIFICATIONS OF THE SOFTWARE
bull High-level language for numerical computation visualization and application development
bull Interactive environment for iterative exploration design and problem solving
bull Mathematical functions for linear algebra statistics Fourier analysis filtering optimization numerical integration and solving ordinary differential equations
bull Built-in graphics for visualizing data and tools for creating custom plots
bull Development tools for improving code quality and maintainability and maximizing performance
bull Tools for building applications with custom graphical interfaces
Conclusion From this practical we can learn installing procedure of process and control instrumentation Simulating and Analyzing software and its features
Question bank
1) Give the full form of Matlab
2) Give the name of Simulating and Analysing softwares
3) which indicates that MATLAB is waiting for a command to be entered a) gtgt b) clc c) d) ^ 4) Which command is used for clear screen 5) Matlab has Built-in graphics for visualizing data and tools for creating custom plots True or False
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 8
PRACTICAL 2
Aim Develop mathematical model for a single process parameter of a tank system
Tank system Parameters
Height of tank
024m Maximum
fill level 02m
Radius of
tank0105m
Tank capacity volume 00069237m3
Figure 1 Fig shows process model Figure 2 Fig shows level sensor probe
Liquid
inflow qi(t)
Liquid
outflow
qo(t) Height
outflow h
Area A
Rate of change of volume = inflow -outflow
119889119907
119889119905= 119902119894(119905) minus 1199020(119905)
Now volume = area x height
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 7
4 Start the simulation You can see the graph on scope screen
ESSENTIAL FEATURESSPECIFICATIONS OF THE SOFTWARE
bull High-level language for numerical computation visualization and application development
bull Interactive environment for iterative exploration design and problem solving
bull Mathematical functions for linear algebra statistics Fourier analysis filtering optimization numerical integration and solving ordinary differential equations
bull Built-in graphics for visualizing data and tools for creating custom plots
bull Development tools for improving code quality and maintainability and maximizing performance
bull Tools for building applications with custom graphical interfaces
Conclusion From this practical we can learn installing procedure of process and control instrumentation Simulating and Analyzing software and its features
Question bank
1) Give the full form of Matlab
2) Give the name of Simulating and Analysing softwares
3) which indicates that MATLAB is waiting for a command to be entered a) gtgt b) clc c) d) ^ 4) Which command is used for clear screen 5) Matlab has Built-in graphics for visualizing data and tools for creating custom plots True or False
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 8
PRACTICAL 2
Aim Develop mathematical model for a single process parameter of a tank system
Tank system Parameters
Height of tank
024m Maximum
fill level 02m
Radius of
tank0105m
Tank capacity volume 00069237m3
Figure 1 Fig shows process model Figure 2 Fig shows level sensor probe
Liquid
inflow qi(t)
Liquid
outflow
qo(t) Height
outflow h
Area A
Rate of change of volume = inflow -outflow
119889119907
119889119905= 119902119894(119905) minus 1199020(119905)
Now volume = area x height
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 8
PRACTICAL 2
Aim Develop mathematical model for a single process parameter of a tank system
Tank system Parameters
Height of tank
024m Maximum
fill level 02m
Radius of
tank0105m
Tank capacity volume 00069237m3
Figure 1 Fig shows process model Figure 2 Fig shows level sensor probe
Liquid
inflow qi(t)
Liquid
outflow
qo(t) Height
outflow h
Area A
Rate of change of volume = inflow -outflow
119889119907
119889119905= 119902119894(119905) minus 1199020(119905)
Now volume = area x height
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 9
119889119860ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
119860119889ℎ
119889119905= 119902119894(119905) minus 1199020(119905)
Two assumptions are made here
1 Cross sectional area is constant 2 Output flow is proportional to height
1199020 =ℎ
119877
119860119889ℎ
119889119905= 119902119894(119905) minus
ℎ
119877
Where R=restriction
Taking Laplace transform on both the side of equation we get
119860119904ℎ(119904) = 119902119894(119904) minusℎ(119904)
119877
119860119877119904ℎ(119904) = 119877119902119894(119904)ℎ(119904)
Now taking h(s) as common we get
ℎ(119904)(119860119877119904 + 1) = 119877119902119894(119904)ℎ(119904)
ℎ(119904)
119902119894(119904)=
119877
119860119877119904 + 1
Now k = R t = A R
R = k = 1000secm2
t = A R = 4 140 = 335195 min
Now transfer function become
119877
119860119877119904 + 1=
1000
335195119904 + 1
Conclusion From this practical we can learn how to find the process model for the given process control system
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 10
PRACTICAL-3 Aim Simulate a simple feedback loop for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
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 The measured response in normalized units is shown below
heatex_plotdata
title(Measured response to step change in steam valve voltage)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 11
The values t1 and t2 are the times where the response attains 283 and 632 of its final value You can use these values
to estimate the time constant tau and dead time theta for the heat exchanger
t1 = 218 t2 = 360
tau = 32 ( t2 - t1 )
theta = t2 - tau
tau = 213000
theta = 147000
Verify these calculations by comparing the first-order-plus-deadtime response with the measured response
s = tf(s)
Gp = exp(-thetas)(1+taus)
Gp =
1
exp(-147s) ----------
213 s + 1
Continuous-time transfer function
hold on step(Gp) hold off
title(Experimental vs simulated response to step change)
Feedback Control
The transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 12
models how a change in the voltage V driving the steam valve opening affects the tank temperature T while the transfer
function
models how a change d in inflow temperature affects T To regulate the tank temperature T around a given setpoint Tsp
we can use the following feedback architecture to control the valve opening (voltage V)
Figure Feedback Control
In this configuration the proportional-integral (PI) controller
Kc = 0859 (theta tau)^(-0977)
tauc = ( tau 0674 ) ( theta tau )^0680
C = Kc (1 + 1(taucs))
Kc = 12341
tauc = 245582
the feedback loop and simulate the response to a set point change
Tfb = feedback((GpC)1)
step(Tfb) grid on
title(Response to step change in temperature setpoint T_sp)
ylabel(Tank temperature)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 13
Question bank
1) Draw a simple close loop and open loop
2) Give the function of hold on and hold off instruction
3) Write instruction for feedback loop 4) Which controller is used for above feedback loop 5) Write instruction for axis label
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 14
PRACTICAL-4 Aim Determine poles and zeros of given first order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Response of First Order Transfer Functions
Laplace Domain
gtgtnum=[0 1]
gtgt den=[10 1]
gtgt s=tf(numden)
s = 1
--------
10 s + 1
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 15
Unit step
num=[1 2]
den=[5 2 0]
s=tf(numden)
s = s + 2
-----------
5 s^2 + 2 s
Continuous-time transfer function
gtgt pzmap(s)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 16
Unit ramp
num=[1 2]
den=[5 5 0 0]
s=tf(numden)
s = s + 2
-------------
5 s^3 + 5 s^2
Continuous-time transfer function
gtgt pzmap(s)
Conclusion From this practical we can determine the pole and zero on pole zero map in
matlab
Question bank
1) What is TF
2) Give the equation of First Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 17
4) Which instruction is used to denote poles and zeros in MATLAB
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 18
PRACTICAL-5 Aim Obtain poles and zeros of given second order transfer function
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Transfer function of second order
Where
k the gain of the system
ζ the damping ratio of the system
ωn the (undamped) natural frequency of the system
Three cases
ζ = 1 critically damped case
ζ gt 1 overdamped case
0 lt ζ lt 1 underdamped case
Transfer function=1( s^2 + 12 s + 1)
gtgtnum=[0 1]
gtgtden=[1 12 1]
gtgts=tf(numden)
s = 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 19
--------------
s^2 + 12 s + 1
Continuous-time transfer function
gtgt pzmap(s)
Transfer function=1( s^2 + 08 s + 1)
gtgtnum=[1]
gtgtden=[1 08 1]
gtgt g=tf(numden)
g = 1
---------------
s^2 + 08 s + 1
gtgtpzmap(g)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 20
Conclusion From this practical we can determine the pole and zero of second order transfer
function on pole zero map in matlab
Question bank
1) What is TF
2) Give the equation of second Order Transfer Function
3) Which instruction is used to denote Transfer Function in Matlab
4) Which instruction is used to denote poles and zeros in Matlab
5) Poles and zeros are indicated with which sign in map
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 21
PRACTICAL-6 Aim Simulate P -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 22
Proportional Control
From the table shown above we see that the proportional controller (Kp) reduces the rise time increases the overshoot
and reduces the steady-state error
The closed-loop transfer function of the above system with a proportional controller is
Let the proportional gain ( ) equal 300 and change the m-file to the following
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 23
OUTPUT
INPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 24
OUTPUT
For ramp signalkp=300
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 25
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
Kp=200
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 26
Question bank
1) Give the name of continuous controller
2) what is value of step function if tgt0
3) what is kp
4) from above step outputs derive steady state values
5) which instruction is used for p-controller
Faculty sign
Date
Grade
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 27
PRACTICAL-7 Aim Simulate I -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open Matlab
bull Open Matlab simulink library
bull Add blocks from simulink library to untitled window
bull Press double click to change the block parameter
bull Start simulation and observe graph
system
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 28
For step signalki=70
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 29
For step signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 30
For ramp signalki=70
INPUT
bull
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 31
For ramp signalki=100
INPUT
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 32
Question bank
1) Which system is used in above practical
2) Which to signals are used in above practical
3) What is ki
4) How can we change the value of block
5) Write the TFof above system
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 33
PRACTICAL-8 Aim Simulate P+I -control action on a given system for given stepramp input and set point Obtain
the effect on output varying Kp and Ki of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 34
Proportional-Integral Control
Before going into a PID control lets take a look at a PI control From the table we see that an
integral controller (Ki) decreases the rise time increases both the overshoot and the settling
time and eliminates the steady-state error For the given system the closed-loop transfer
function with a PI control is
Lets reduce the to 30 and let equal 70 Create an new m-file and enter the following
commands
Kp = 30
Ki = 70
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
with Kp = 30 Ki = 70
Continuous-time PI controller in parallel form
T =
30 s + 70
------------------------
s^3 + 10 s^2 + 50 s + 70
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 35
Continuous-time transfer function
Run this m-file in the MATLAB command window and you should get the following plot
We have reduced the proportional gain (Kp) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect) The
above response shows that the integral controller eliminated the steady-state error
For kp=40ki=80
Kp = 40
Ki = 80
C = pid(KpKi)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki ---
s
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 36
with Kp = 40 Ki = 80
Continuous-time PI controller in parallel form
T =
40 s + 80
------------------------
s^3 + 10 s^2 + 60 s + 80
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 37
For ramp signalKp=30 Ki=70
INPUT
OUTPUT
For ramp signalKp=40 Ki=80
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 38
INPUT
OUTPUT
Question bank
1) Integral controller (Ki) eliminates the steady-state error TRUE or FALSE
2) what is value of unit step function if tlt0
3) What is effect on peak values if we are changing kpki
4) Integral controller (Ki) decreases the rise timeTRUE or FALSE
5) Which instruction is used for p-i controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 39
PRACTICAL-9 Aim Simulate P+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp and Kd of the system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 40
Proportional-Derivative Control
Now lets take a look at a PD control From the table shown above we see that the derivative controller (Kd) reduces
both the overshoot and the settling time The closed-loop transfer function of the given system with a PD controller is
(8)
Let equal 300 as before and let equal 10 Enter the following commands into an m-file and run it in the MATLAB
command window
Kp = 300
Kd = 10
C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
with Kp = 300 Kd = 10
Continuous-time PD controller in parallel form
T = 10 s + 300
----------------
s^2 + 20 s + 320
Continuous-time transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 41
This plot shows that the derivative controller reduced both the overshoot and the settling time and had a small effect on
the rise time and the steady-state error
with Kp = 320 Kd = 20
Kp = 320
gtgt Kd =20
gtgt C = pid(Kp0Kd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
Kp + Kd s
Continuous-time PD controller in parallel form
T = 20 s + 320
----------------
s^2 + 30 s + 340
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 42
Continuous-time transfer function
Question bank
1) Give the type of pd controller
2) what is value of step function if tlt0
3) What are peak values if we are changing kpkd
4) Obtain the output of pd when we are using ramp as input signal
5) which instruction is used to draw p-d controller
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 43
PRACTICAL-10 Aim Simulate P+I+D -control action on a given system for given stepramp input and set point
Obtain the effect on output varying Kp Kd and Ki of the system
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
PROGRAM
Suppose we have a simple mass spring and damper problem
The modeling equation of this system is
Taking the Laplace transform of the modeling equation we get
The transfer function between the displacement and the input then becomes
Let
M = 1 kg b = 10 N sm k = 20 Nm F = 1 N
Plug these values into the above transfer function
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 44
Proportional-Integral-Derivative Control
Now lets take a look at a PID controller The closed-loop transfer function of the given system
with a PID controller is
After several trial and error runs the gains = 350 = 300 and = 50 provided the
desired response To confirm enter the following commands to an m-file and run it in the
command window You should get the following step response
Kp = 350
Ki = 300
Kd = 50
C = pid(KpKiKd)
T = feedback(CP1)
t = 00012
step(Tt)
C =
1
Kp + Ki --- + Kd s
s
with Kp = 350 Ki = 300 Kd = 50
Continuous-time PID controller in parallel form
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 45
General Tips for Designing a PID Controller
When you are designing a PID controller for a given system follow the steps shown below to
obtain a desired response
1 Obtain an open-loop response and determine what needs to be improved
2 Add a proportional control to improve the rise time
3 Add a derivative control to improve the overshoot
4 Add an integral control to eliminate the steady-state error
5 Adjust each of Kp Ki and Kd until you obtain a desired overall response
Question bank
1) Give the equation of pid controller from above process
2) Obtain the output of pid when kp=200kd=100ki=25
3) Which instruction is used for pid controller
4) Obtain the output of pid when we are using ramp as input signal
5) Which type of pid controller is used
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 46
PRACTICAL-11 Aim Simulate a simple feed forward loop for process parameter and obtain output varying
set point
SOFTWARE REQUIRED
bull MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
This example shows how to design feedforward compensators to regulate the temperature
of a chemical reactor through a heat exchanger
Heat Exchanger Process
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
Figure 1 Stirring Reactor with Heat Exchanger
Interactive Simulation
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 47
To gain additional insight and interactively tune the feedforward use the companion GUI and
Simulink model
gtgtheatex
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 48
Conclusion From the above practical we can Simulate a simple feed forward loop for
process parameter and obtain output varying set point
Question bank
1) What do you mean by feed forward control
2) What indicates dTv
3) Which instruction is used for feed forward process
4) What indicates C Gd Gp
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 49
PRACTICAL-12 Aim Simulate a simple cascade loop for process parameter
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
Cascade control is mainly used to achieve fast rejection of disturbance before it
propagates to the other parts of the plant The simplest cascade control system involves
two control loops (inner and outer) as shown in the block diagram below
Controller C1 in the outer loop is the primary controller that regulates the primary
controlled variable y1 by setting the set-point of the inner loop Controller C2 in the inner
loop is the secondary controller that rejects disturbance d2 locally before it propagates
to P1 For a cascade control system to function properly the inner loop must respond
much faster than the outer loop
In this example you will design a single loop control system with a PI controller and a
cascade control system with two PI controllers The responses of the two control systems
are compared for both reference tracking and disturbance rejection
Plant
In this example the inner loop plant P2 is
The outer loop plant P1 is
P2 = zpk([]-23)
P1 = zpk([][-1 -1 -1]10)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 50
Designing a Single Loop Control System with a PI Controller
Use pidtune command to design a PI controller in standard form for the whole plant
model P = P1 P2
The desired open loop bandwidth is 02 rads which roughly corresponds to the response
time of 10 seconds
The plant model is P = P1P2
P = P1P2
Use a PID or PIDSTD object to define the desired controller structure
C = pidstd(11)
Tune PI controller for target bandwidth is 02 rads
C = pidtune(PC02)
C
C =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 00119 Ti = 0849
Continuous-time PI controller in standard form
Designing a Cascade Control System with Two PI Controllers
The best practice is to design the inner loop controller C2 first and then design the outer
loop controller C1 with the inner loop closed In this example the inner loop bandwidth
is selected as 2 rads which is ten times higher than the desired outer loop bandwidth In
order to have an effective cascade control system it is essential that the inner loop
responds much faster than the outer loop
Tune inner-loop controller C2 with open-loop bandwidth at 2 rads
C2 = pidtune(P2pidstd(11)2)
C2
C2 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0244 Ti = 0134
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 51
Continuous-time PI controller in standard form
Tune outer-loop controller C1 with the same bandwidth as the single loop system
Inner loop system when the control loop is closed first
clsys = feedback(P2C21)
Plant seen by the outer loop controller C1 is clsysP1
C1 = pidtune(clsysP1pidstd(11)02)
C1
C1 =
1 1
Kp (1 + ---- ---)
Ti s
with Kp = 0015 Ti = 0716
Continuous-time PI controller in standard form
Performance Comparison
First plot the step reference tracking responses for both control systems
single loop system for reference tracking
sys1 = feedback(PC1)
set(sys1NameSingle Loop)
cascade system for reference tracking
sys2 = feedback(clsysP1C11)
set(sys2NameCascade)
plot step response
figurestep(sys1rsys2b)
legend(showlocationsoutheast)
title(Reference Tracking)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 52
Secondly plot the step disturbance rejection responses of d2 for both control systems
single loop system for rejecting d2
sysd1 = feedback(P1P2C)
set(sysd1NameSingle Loop)
cascade system for rejecting d2
sysd2 = P1(1+P2C2+P2P1C1C2)
set(sysd2NameCascade)
plot step response
figurestep(sysd1rsysd2b)
legend(show)
title(Disturbance Rejection)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 53
From the two response plots you can conclude that the cascade control system performs
much better in rejecting disturbance d2 while the set-point tracking performances are
almost identical
Conclusion From this practical we can simulate cascade loop using matlab
Question bank
1) how many loops are there in cascade control
2) Give the value of P2if P2= P2 = zpk([]-23)
3) Which response is ploted in graph
4) Which controller is used in cascade process
5) Give Continuous-time PI controller in standard form
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 54
PRACTICAL-13 Aim Simulate a simple ratio control for process parameter and obtain output varying set
point
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Procedure
The two variables are usually flow rates a manipulated variable u and a
disturbance variable d Thus the ratio R=du is controlled rather than the
individual variables
A ratio control scheme is to be used to maintain a ratio of H2 and N2 as the feed
to an ammonia synthesis reactor Individual flow controllers will be used for both
the H2 and N2 streams Draw a schematic diagram for the ratio control scheme
and specify the appropriate gain for the ratio station KR
Solution
The equation for the ammonia synthesis reaction is
3H2+N2=2NH3
In order to introduce the feed mixture in proportions the ratio of the molar flow
rates (H2N2) should be 31 For the sake of simplicity we assume that the ratio
of the molar flow rates is equal to the ratio of the volumetric flow rates But in
general the volumetric flow rates also depend on the temperature and pressure of
each stream (the ideal gas law)
The schematic diagram for the ammonia synthesis reaction is shown in Fig The
H2 flow rate is considered to be the disturbance variable although this choice is
because both the H2 and N2 flow rates are controlled Note that the ratio station
is merely a device with an adjustable gain The input signal to the ratio station is
dm the measured H2 flow rate Its output signal usp serves as the set point for
the N2 flow control loop It is calculated as
usp = KR dm
From the equation it follows that the desired ratio is Rd = ud = 13
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 55
Fig
Block representation in Matlab
OUTPUT
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 56
Conclusion
Question bank
1) Give the equation of ratio controller
2) Give ammonia synthesis reaction equation
3) Describe the function of mux block
4) Prepare ratio control for water
5) What is dm
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 57
PRACTICAL-14 Aim Simulate non interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Non-Interacting Liquid Level System
The two tank non-interacting liquid level system is shown in Fig 1 It consists of two
tanks namely tank 1 and tank 2 Various parameters and their values are mentioned in
Table I The outlet flow from the tank 1 discharges directly into tank 2 Moreover liquid
flow through valve R1 depends only on h1 The variation in h2 in tank 2 does not affect
the transient response occurring in tank 1 Hence this type of a system is known as a
non-interacting system By simple mathematical calculation one can get transfer function
of system Let us apply mass balance equation to tank 1 as
helliphelliphelliphelliphelliphellip(1)
Similarly applying mass balance to tank 2 gives
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 58
helliphelliphelliphelliphelliphellip (2)
The flow-head relationships for the two linear resistances are given by
helliphelliphelliphelliphelliphelliphelliphellip (3)
helliphelliphelliphelliphelliphelliphelliphelliphelliphellip(4)
Combining (1)-(4) transfer functions for tank 1 and tank 2 are obtained as
helliphelliphelliphelliphelliphellip (5)
helliphelliphelliphelliphelliphelliphellip(6)
where τ1= R1 A1 and τ 2= R2 A2 Therefore the overall transfer function is determined
as
helliphelliphelliphelliphellip (7)
Substituting the values from Table I the complete transfer function is calculated as
helliphelliphelliphelliphelliphelliphellip (8)
It should be noted that the variable to be controlled is h2 ie height of tank 2 by
manipulating the flow rate in tank 1 ie q The roots of denominator polynomial are found
to be (-1 -2) Hence the open loop response is observed to be overdamped
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=1(05s^2+15s+1)
Transfer function
1
-------------------
05 s^2 + 15 s + 1
gtgt step(G)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 59
Perform PID control using matlab Simulink with trial error method
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 60
PRACTICAL-15 Aim Simulate interacting level system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Introduction to Cascade Control
The controls of liquid level in multiple tanks and flow between the tanks are basic
problems in the process industries The process industries require liquid to be pumped and
stored in the tanks and then pump it to another tank Often the tanks are so coupled
together that the levels interact and these must also be controlled
About 95 of process control loops are of PID or PI type Since its inception over eighty
years ago the proportional-integral-derivative (PID) control structure has remained the
most commonly used single-input single-output (SISO) technique in industry primarily
because it is one of the simplest
Modeling Of Two Tank Interacting Liquid Level System
Consider the process consisting of two interacting liquid tanks in the Figure 1 The
volumetric flow into tank1 is qin (cm3min) the volumetric flow rate from tank1 to tank2
is q1(cm3min) and the volumetric flow rate from tank2 is qo(cm3min) The height of
the liquid level is h1 (cm) in tank1 and h2 in tank2 (cm)
Both tanks have the same cross sectional area denotes the area of tank1 is A1 (cm2) and
area of tank2 is A2(cm2)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 61
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 62
Matlab Command
gtgt s=tf(s)
Transfer function
s
gtgt G=001(025s^2+75s+1)
Transfer function
001
--------------------
025 s^2 + 75 s + 1
gtgt step(G)
gtgt
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 63
Perform PID control using matlab Simulink with following parameters
1 P=20
2 P=20 I=12
3 P=20 D=10
4 P=12 I=4 D=10
Comment on each output above
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 64
PRACTICAL-16 Aim Simulate On-Off LEVEL control system using process control simulator
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
Output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 65
Conclusion
Question bank
1)
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 66
PRACTICAL-17 Aim LabVIEW Program for degree Celsius to Fahrenheit Conversion
Step 1 Open the LabVIEW and click on Blank VI
Step 2 Now you will see two windows on your computer screen One is lsquofront panelrsquo and other is
lsquoblock diagramrsquo To properly adjust both of them on your screen press ldquoCtrl+trdquo from your
keyboard
Step 3 Now you will see both the windows are adjusted on a single screen Move your cursor on
block diagram window and right click on empty space The available function will appear Click
on structures and then click on while loop Now draw the while loop (box) by dragging your
mouse on block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 67
Step 4 In this first LabVIEW program we are converting temperature readings from degree
Celsius to degree Fahrenheit So in short we are implementing the formula to convert CgtF as
shown below
Step 5 First of all we have to take a slider to vary the Celsius readings To bring a slider right
click on the front panel Available controls will appear Move cursor on ldquoNumericrdquo and click on
ldquovertical fill sliderdquo You can give a name to the slider Here we are using this slider for degree
Celsius readings therefore I have named as ldquoDeg Crdquo In this way we have completed ldquoCrdquo Now
we have to multiply this ldquoCrdquo with ldquo95rdquo as shown in the formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 68
Step 6 To multiply ldquoCrdquo with ldquo95rdquo we will first multiply it with 9 and then divide it by 5 To
multiply ldquoCrdquo with 9 we have to take ldquomultiplierrdquo Right-click on block diagram gt numeric gt
multiply Same steps will be needed for taking divider and for addition with 32 as from formula
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 69
Step 7 for taking ldquo9rdquo ie constant right click on block diagram gt numeric gt numeric constant
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 70
Step 8 Similarly take divider and divide by 5 Take addition and add 32 Now your block
diagram will look like this
Step 9 Now we have shown this converted temperature readings (which are now in Fahrenheit)
on the numeric indicator Right click on front panel gt numeric gt numeric indicator I have given
the name as ldquoDeg Frdquo to this numeric indicator
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 71
Step 10 Finally we have to create a control for the while loop to stop the program at any time To
create a control right click on red button ie ldquoloop conditionrdquo and select ldquocreate controlrdquo
Step 11 Save the program by pressing ldquoCtrl+Srdquo
Step 12 Click on run button available in the block diagram window
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 72
Step 13 Now vary the slider you will see a corresponding change in degree Fahrenheit output
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 73
PRACTICAL-18 Aim Simulate three element boiler control system
SOFTWARE REQUIRED
MATLAB R2012a
PROCEDURE
bull Open MATLAB
bull Open new M-file
bull Type the program
bull Save in current directory
bull Compile and Run the program
bull For the output see command window Figure window
Three element drum level control Three-element level control as shown in Fig1 is the most
common boiler drum level control strategy A feed water flow loop slave is added to the two-
element strategy Three-element level control linearizes the feed water flow with respect to the
steam flow and the level controller output The control loop now requests volumetric flow
change not just a change in the valve position This strategy attempts to compensate for
changes or disturbances in steam flow and feed water flow based on the principle that flow in
equals flow out The installed characteristics of the feed water valve are no longer an issue
because the flow controller can compensate Using this approach the steam feed forward
element can be a simple gain without requiring characterization
The relationship between the feed water flow rate and drum level for the boiler process are
expressed by the following equations The process function valve function and disturbance
function is shown below
Gp(s)= [025(-s+1)] [s(2s+1)]
Gv(s) = 1[015s+1]
Gd(s)=[ -025(-s+1)] [s(s+1)(2s+1)]
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 74
Following are the process used to determine the PID gain parameter
1) ZieglerndashNichols Method
This method is introduced by John G Ziegler and Nathaniel B Nichols In this method the
Ki and Kd gains are first set to zero The Kp gain is increased until it reaches the ultimate
gain Ku at which the output of the loop starts to oscillate Ku is found to be 351 Pu is
98Ku and the oscillation period Pu are used to set the gains as shown in Table 1
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 75
Conclusion
Question bank
1) Which measurement is available in three element boiler control system
2) Give the Transfer Function
3) Which controller is used in above process
4) Which method is used to determine the PID gain parameter 5) What is Ku and Pu
Faculty Sign
Grade
Date
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 76
PRACTICAL 19 1 Obtain pole zero amp gain values of a transfer function
a 119918(119956) =119956120784+120786119956+120785
(119956+120787)(119956120784+120786119956+120789)
b 119918(119956) =120783
(119956120784+119956+120786)
c 119918(119956) =120787
(119956120784+120791)
d 119918(119956) =120783
(119956120784+120785119956+120787)(119956+120785)(119956+120787)
2 Write matlab code to obtain transfer function of a system from its pole zero gain values
a Poles= -2 1 Zero=-1 and gain=7
b Poles = -1+i -1-i -4 Zeros = -2 -5 gain = 1
c Poles = -1+4i -1-4i -5 Zeros = -8 -5 gain = 75
3 Obtain step response of a unity feedback system having forward path transfer function of
a 119918(119956) =120783
(119956+120786)
b 119918(119956) =120785
(119956120784+120786119956+120791)
c 119918(119956) =120785
(119956+120783) (119956120784+120786119956+120791)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 77
PRACTICAL 20 1 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783120782) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784+120783
119956120784+120786119956+120786) 119918120786(119956) =
119956+120783
119956+120788
119919120783(119956) =119956+120783
119956+120784 119919120784(119956) = 120784 119919120785(119956) = 120783
MATLAB solution
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 78
2 For the following multi-loop feedback system get closed loop transfer function and the
corresponding pole-zero map of the system
119918120783(119956) =120783
(119956+120783) 119918120784(119956) =
120783
(119956+120783) 119918120785(119956) =
119956120784
119956120784+120786119956+120786 119918120786(119956) =
120783
119956+120788
119919120783(119956) = 120783 119919120784(119956) = 120784 119919120785(119956) = 120783
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 79
PRACTICAL 21
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PD controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1= [1 10 20]
g2=tf (num1 den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Kd=10
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Kd=5
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t4=feedback(g31)
step(t4y)
hold on
Kp=500
Kd=01
numc=[Kd Kp]
numo=conv(numcnum)
deno=den
g3=tf(numodeno)
t5=feedback(g31)
step(t5r)
hold on
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 80
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PD controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 81
PRACTICAL 22
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
(119956120784+120783120782119956+120784120782)
Show the effect of addition of a PI controller on the system performance
Matlab Code
num=1
den=[1 10 20]
g1=tf (numden)
t1=feedback(g11)
step(t1g)
hold on
num1=10
den1=[1 10 20]
g2=tf (num1den1)
t2=feedback(g21)
step(t2m)
hold on
Kp=500
Ki = 1
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t3=feedback(g31)
step(t3b)
hold on
Kp=500
Ki = 100
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
t4=feedback(g31)
step(t4r)
hold on
Kp=500
Ki = 500
numc=[Kp Ki]
denc= [1 0]
numo=conv(numcnum)
deno=conv(dendenc)
g3=tf(numodeno)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 82
t5=feedback(g31)
step(t5g)
hold on
Output
2 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PI controller on the system performance
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)
ISP(3341705) IC DEPT
GPGANDHINAGAR Page 83
PRACTICAL 23
1 Consider a unity feedback system with forward path transfer function 119918(119956) =120783
119956(119956+120783120788) Show
the effect of addition of a PID controller on the system performance
2 Show how to transfer step input plant input and plant output data to MATLAB workspace
for a unity feedback system with 119918(119956) =120783
119956(119956+120783120788)