DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
Student Name: Bilal Ubaid
Registration Number: 18PWMCT0602
Lab No.09: Observe the output of PID controller.
Criteria (Taxonomy Excellent (4) Proficient (3) Basic (2) Below Basic (1) Student’s
Level) Score
Report is mostly Report is
as per the guidelines disorganized and
To organize the lab follows some Sections/Step
Report is as per and most s are not
report and practice the guidelines but
the guidelines. All most of the
writing skills as per the sections/steps are
sections/steps are ordered and
guidelines
clearly organized in ordered well but guidelines are Report is not as
a logical order. requires minor missing
improvements. per the
guidelines
The report
completely
discusses the The report
discusses the
required experiment/lab
The report The report is
discusses the work but have totally
experiment/lab
To discuss the actual required
work in own words irrelevant
experiment/task irrelevant to the
with some relevant experiment/lab work information experiment/lab
additional
work
information
Calculations and
data analysis were
performed
accurately, but Most data and
minor errors were observations were
Calculations and recorded Calculations
data analyses were and data
performed clearly, made both in
adequately, but
To perform calculations with several analyses of lab
concisely, and calculations and in
and data analysis applying correct were missing
significant errors
accurately, with units or omissions.
correct units.
Graphs, if
necessary, were
drawn accurately Graphs, if Major
Graphs, if
necessary, were necessary, were components of
and neatly and
To present results in the drawn adequately drawn but lab were
were clearly
form of graphs inadequately. missing
labelled.
1
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
LAB NO: 09
TITLE: OBSERVE THE OUTPUT OF PID
CONTROLLER.
OBJECTIVES:
To study the detail theory of PID.
Design the PID controller using command in m.file.
Design the PID controller in Simulink.
Manual Tuning of PID controller for desired output.
Apply the PID controller to a real time system.
SOFTWARE OR TOOL:
MATLAB (with control toll box)
THEORY:
CONTROLLER:
A controller is a mechanism that seeks to minimize the difference between the actual value of a
system (i.e. the process variable) and the desired value of the system (i.e. the set point). Controllers
are a fundamental part of control engineering and used in all complex control systems.
WHY CONTROLLER:
1. Controllers improve the steady-state accuracy by decreasing the steady state error.
2. As the steady-state accuracy improves, the stability also improves.
3. Controllers also help in reducing the unwanted offsets produced by the system.
4. Controllers can control the maximum overshoot of the system.
5. Controllers can help in reducing the noise signals produced by the system.
6. Controllers can help to speed up the slow response of an overdamped system.
2
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
OBJECTIVES OF A CONTROLLER:
The main objectives of controller are:
1. Decrease the maximum overshot
2. Reduce the rise time
3. Reduce the settling time
4. Reduce steady-state error
TYPES OF CONTROLLERS:
There are two main types of controllers: continuous controllers, and discontinuous controllers.
In discontinuous controllers, the manipulated variable changes between discrete values.
Depending on how many different states the manipulated variable can assume, a distinction is
made between two position, three position, and multi-position controllers. Compared to continuous
controllers, discontinuous controllers operate on very simple, switching final controlling elements.
The main feature of continuous controllers is that the controlled variable (also known as the
manipulated variable) can have any value within the controller’s output range. Now in the
continuous controller theory, there are three basic modes on which the whole control action takes
place, which are:
1. Proportional controllers.
2. Integral controllers.
3. Derivative controllers.
We use the combination of these modes to control our system such that the process variable is
equal to the setpoint (or as close as we can get it). These three types of controllers can be combined
into new controllers:
1. Proportional and integral controllers (PI Controller)
2. Proportional and derivative controllers (PD Controller)
3. Proportional integral derivative control (PID Controller)
3
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
DRAWBACKS OF PROPORTIONAL CONTROLLER:
With proportional controller we reduced the rise time, reduce the steady-state error, and
decreased the settling time by a small amount but Maximum overshoot occur.
DRAWBACKS OF PROPORTIONAL DERIVATIVE
CONTROLLER:
With proportional Derivative controller we reduce the overshoot, the settling time but it have negligible
effect on the rise time and steady state error.
DRAWBACKS OF PROPORTIONAL INTEGRAL
CONTROLLER:
With proportional integral controller we reduce the rise time, the steady state error but it Increases the
maximum overshoot.
P, PD AND PI CONTROLLER:
The proportional controller (KP) will have the effect of reducing the rise time and will reduce, but
never eliminate, the steady state error. An integral controller (KI) will have the effect of
eliminating the steady state error, but it may make the transient response worse. A derivative
control (KD) will have the effect of increasing the stability of the system, reducing the overshoot
and improving the transient response.
Table: 9.1
CLOSED RISE TIME OVERSHOOT SETTLING STEADY
LOOP TIME STATE
RESPONSE ERROR
Kp Decreases Increases Small Change Decreases
Ki Decreases Increases Increases Eliminates
Kd No Change Decreases Decreases Small Change
4
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
PROPORTIONAL INTEGRAL DERIVATIVE (PID)
CONTROLLER:
As the name suggests it is a combination of proportional, Integral and a derivative controller. PID controller
is used to overcome the drawback of Proportional, Proportional derivative and Proportional integral
controllers.
Fig: 9.1
METHEMATICAL MODELLING:
Let:
m = 1[kg]
b = 10[Ns/m]
k = 20[N/m]
The transfer function become
𝑋(𝑠) 1
=
𝐹(𝑠) 𝑠 + 10𝑠 + 20
5
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
STEP RESPONSE OF SYSTEM:
clear all
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum)
step(system)
stepinfo(system)
Fig: 8.1
SS error = Initial Value-Final Value
= 1- 0.05=0.95
The error is too large so using proportional will minimize the SS error.
6
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
APPLY PROPORTIONAL DERIVATIVE CONTROLLER :
Fig: 9.2
clear all
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum)
Kp = 1;
C = pid(Kp)
T = feedback(C*system,1)
linearSystemAnalyzer(T)
clear all
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum) ;
Kp1 =1;
C1 = pid(Kp1);
T1 = feedback(C1*system,1);
Kp2 =10;
C2 = pid(Kp2);
7
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
T2 = feedback(C2*system,1);
MtE-328L Control system LAB, 6th Semester
Kp3 =100;
C3 = pid(Kp3);
T3 = feedback(C3*system,1);
Kp4 =500;
C4 = pid(Kp4);
T4 = feedback(C4*system,1);
linearSystemAnalyzer(T1,T2,T3,T4);
Fig: 9.3
WITH PID CONTROLLER:
clear all
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum) ;
Kp =10;
8
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
Ki=10;
Kd=10;
C = pid(Kp,Ki,Kd);
T = feedback(C*system,1);
linearSystemAnalyzer(T)
9
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
SYSTEM MODELLING IN SIMULINK:
PID CONTROLLER:
Fig: 9.5
RESULT:
Fig: 9.6
10
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
DISCUSSION:
The above experimentation shows that with PID controller we can
1. Decrease the maximum overshot
2. Reduce the rise time
3. Reduce the settling time
4. Reduce steady-state error
IN LAB TASK:
PART A AND B:
Table: Part b
S. No Kp Ki Rise Time Max Overshoot Settling Time Steady State Error
(%)
1 2 0.2 0.0943 1.13 0.147 0.853
11
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
2 10
MtE-328L 1
Control 0.0227
system LAB, 627.3
th Semester 0.167 0.833
3 100 10 0.0053 68.2 0.169 0.831
GRAPH:
Fig: Max Overshoot for Part b
Fig: Settling Time for Part b
12
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
Fig: Rise Time for part b
DISCUSSION:
By increasing Kp, Ki is also increasing. Investigating the results shows that rise time has decreased
and overshoot has increased while settling time and steady state error has slightly decreased.
PART C:
Table: Part c
S. No Kp Ki Kd Rise Time Max Overshoot Settling Time Steady State
(%) Error
1 100 10 0.1 0.00597 49.9 0.0839 0.9161
2 100 10 0.9 0.0227 7.11 0.0245 0.9755
3 100 10 2 0.00273 0.373 0.0048 0.9952
13
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
Fig: Overshoot for part c
DISCUSSION:
By increasing Kd, the results shows that rise time has decreased and overshoot has decreased while
settling time has decreased and steady state error has slightly increased.
References
[1] "https://www.electrical4u.com/types-of-controllers-proportional-integral-derivative-controllers/,"
[Online]. [Accessed 11 June 2021].
14