Control Lab 10 0670
Control Lab 10 0670
Control Lab 10 0670
Criteria (Taxonomy Excellent (4) Proficient (3) Basic (2) Below Basic (1) Student’s
Level) Score
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 Calculations
recorded
data analyses were and data
performed clearly, made both in
adequately, but
To perform calculations calculations and in with several analyses of lab
concisely, and
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
LAB NO: 10
SOFTWARE OR TOOL:
▪ MATLAB (with control toll box)
THEORY:
TUNING OF PID CONTROLLER:
There are three methods to tune a PID Controller.
• Set integral and derivative terms to zero first and then increase the proportional gain until
the output of the control loop oscillates at a constant rate. This increase of proportional
gain should be in such that response the system becomes faster provided it should not make
system unstable.
• Once the P-response is fast enough, set the integral term, so that the oscillations will be
gradually reduced. Change this I-value until the steady state error is reduced, but it may
increase overshoot.
• Once P and I parameters have been set to a desired values with minimal steady state error,
increase the derivative gain until the system reacts quickly to its set point. Increasing
derivative term decreases the overshoot of the controller response.
2
DEPARTMENT OF MECHATRONICS ENGINEERING
2. ZEIGLER-NICHOLS METHOD :
It is another popular method for tuning PID controllers. Ziegler and Nichols presented two classical
methods for determining values of proportional gain, integral time and derivative time based on
transient response characteristics of a given plant or system.
1) FIRST METHOD:
• Obtain a unit step response of the plant experimentally and it may look‘s’ shaped curve as
shown in figure below. This method applies, if obtained response exhibit s-shaped curve
for unit step input otherwise it cannot be applied. This curve can also be obtained by
dynamic simulation of the plant.
• Obtain two constants, delay time L and time constant T by drawing a tangent line at the
inflection point of the s-shaped curve.
• Set the parameters of Kp, Ti, and Td values from the table given below for three types of
controllers.
3
DEPARTMENT OF MECHATRONICS ENGINEERING
Fig: 10.2
2) SECOND METHOD:
• It is very similar to the trial and error method where integral and derivative terms are set to
the zero, i.e., making Ti infinity and Td zero.
• Increase the proportional gain such that the output exhibits sustained oscillations. If the
system does not produce sustained oscillations then this method cannot be applied. The
gain at which sustained oscillations produced is called as critical gain.
Fig: 10.3
4
DEPARTMENT OF MECHATRONICS ENGINEERING
• Once the sustain oscillations are produced, set the values of Ti and Td as per the given
table for P, PI and PID controllers based on critical gain and critical period. [1]
Fig: 10.4
There is an automatic method for tuning of PID controller using software tool MATLAB by
command, GUI and SIMULINK block diagram.
When you are designing a PID controller for a given system, follow the steps shown below to
obtain a desired response.
EXAMPLE:
Fig: 10.5
5
DEPARTMENT OF MECHATRONICS ENGINEERING
𝑚𝑥.. + 𝑏𝑥. + 𝑘𝑥 = 𝐹
𝑋(𝑠) 1
=
𝐹(𝑠) 𝑚𝑠2 + 𝑏𝑠 + 𝑘
MATHEMATICAL MODELLING:
𝑋(𝑠) 1
=
𝐹(𝑠) 𝑠2 + 10𝑠 + 20
6
DEPARTMENT OF MECHATRONICS ENGINEERING
RESULT:
Fig: 10.6
This is the manual tuning of a PID Controller by changing the Kp, Ki, and Kd values for the PID
controller and looking at the output waveform. In manual tuning, the PID has the following
characteristics in a control system.
Fig: 10.6
7
DEPARTMENT OF MECHATRONICS ENGINEERING
It Designs a PID controller of type (controller) for the plant system. If type specifies a one-degree-
of-freedom (1-DOF) PID controller, then the controller is designed for the unit feedback loop.
Its syntax is C = pidtune (system, types)
System = open loop transfer function of system
Types= Controller type
CONTROLLER TYPES:
'P' — Proportional only
'I' — Integral only
'PI' — Proportional and integral
'PD' — Proportional and derivative
'PDF' — Proportional and derivative with first-order filter on derivative term
'PID' — Proportional, integral, and derivative
'PIDF' — Proportional, integral, and derivative with first-order filter on derivative term
8
DEPARTMENT OF MECHATRONICS ENGINEERING
OUTPUT:
Fig: 10.7
TUNED PD CONTROLLER:
clear all
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum) ;
[C_pD] = pidtune(system,'PD')
T = feedback(C_pD*system,1);
linearSystemAnalyzer(T);
OUTPUT:
9
DEPARTMENT OF MECHATRONICS ENGINEERING
10
DEPARTMENT OF MECHATRONICS ENGINEERING
TUNED PI CONTROLLER:
clear all
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum) ;
[C_pI] = pidtune(system,'PI')
T = feedback(C_pI*system,1);
linearSystemAnalyzer(T);
RESULT:
Fig: 10.9
11
DEPARTMENT OF MECHATRONICS ENGINEERING
RESULT:
Fig: 10.10
12
DEPARTMENT OF MECHATRONICS ENGINEERING
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum) ;
[C_P] = pidtune(system,'P')
[C_P_fast] = pidtune(system,'P',1)
T1 = feedback(C_P*system,1);
T2 = feedback(C_P_fast*system,1);
linearSystemAnalyzer(T1,T2);
Fig: 10.11
13
DEPARTMENT OF MECHATRONICS ENGINEERING
clear all
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum) ;
[C_P] = pidtune(system,'PID')
[C_P_fast] = pidtune(system,'PIDF',1)
T1 = feedback(C_P*system,1);
T2 = feedback(C_P_fast*system,1);
linearSystemAnalyzer(T1,T2);
Fig: 10.12
14
DEPARTMENT OF MECHATRONICS ENGINEERING
pidTuner(P,C)
clear all
clc
clear
num=[1];
dnum=[1 10 20];
system=tf(num,dnum) ;
pidTuner(system,'p')
Fig: 10.13
CONTROLLER TYPE:
Fig: 10.14
14
DEPARTMENT OF MECHATRONICS ENGINEERING
Fig: 10.15
SHOW PARAMETERS:
Fig: 10.16
15
DEPARTMENT OF MECHATRONICS ENGINEERING
LAB TASK 10
COMMAND WINDOW:
16
DEPARTMENT OF MECHATRONICS ENGINEERING
GRAPH:
17
DEPARTMENT OF MECHATRONICS ENGINEERING
18
DEPARTMENT OF MECHATRONICS ENGINEERING
GRAPH:
19
DEPARTMENT OF MECHATRONICS ENGINEERING
GRAPH:
20
DEPARTMENT OF MECHATRONICS ENGINEERING
GUI:
21
DEPARTMENT OF MECHATRONICS ENGINEERING
USING APP:
22
DEPARTMENT OF MECHATRONICS ENGINEERING
23
DEPARTMENT OF MECHATRONICS ENGINEERING
24
DEPARTMENT OF MECHATRONICS ENGINEERING
MtE
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
References
[2] "https://www.electrical4u.com/types-of-controllers-proportional-integral-derivative-controllers/,"
[Online]. [Accessed 11 June 2021].
25