0% found this document useful (0 votes)
3 views

Lab10 CS

Uploaded by

maazismail222
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lab10 CS

Uploaded by

maazismail222
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

DEPARTMENT OF MECHATRONICS ENGINEERING

UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR


MtE-328L Control system LAB, 6th Semester

Student Name: Muaaz Ismail


Registration Number: 19PWMCT0670
Lab No. 10: Observe the output of PID Controller
Criteria (Taxonomy Excellent (4) Proficient (3) Basic (2) Below Basic (1) Student’s
Level) Score
To organize the lab Report is as per the Report is mostly as Report is
per the guidelines Sections/Steps are
report and practice the guidelines. All disorganized and
not ordered and
writing skills as per the sections/steps are and most follows some
sections/steps are Report is not as
guidelines clearly organized in a guidelines but
ordered well but per the guidelines
logical order. most of the
requires minor guidelines are
improvements. missing

The report completely The report discusses The report discusses The report is
To discuss the actual
discusses the required The required the experiment/lab totally irrelevant
experiment/task
experiment/lab work experiment/lab work but have to the
in own words with work irrelevant experiment/lab
some relevant information work
additional
information

To perform calculations Calculations and Calculations and data


analysis were Most data and Calculations and
and data analysis data analyses were observations were data analyses of
performed
performed clearly, recorded adequately lab were missing
accurately, but but with several
concisely, and
minor errors were significant errors or
accurately, with
correct units. made both in omissions.
calculations and in
applying correct
units

Graphs, if necessary, Graphs, if necessary, Graphs, if Major components


To present results in the
were drawn were drawn adequately necessary, were of lab were
form of graphs
accurately and neatly drawn but Missing
and were clearly inadequately.
labelled.

Course Instructor: Engr. Wahad Ur Rahman


DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Lab No: 9

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.

Apparatus and Tools:


• MATLAB Simulink
• Control system Library

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
setpoint). Controllers are a fundamental part of control engineering and are used in all
complex control systems. [1]
Important Uses of Controller:
• Controllers improve the steady-state accuracy by decreasing the steady state error.
• As the steady-state accuracy improves, the stability also improves.
• Controllers also help in reducing the unwanted offsets produced by the system.
• Controllers can control the maximum overshoot of the system.
• Controllers can help in reducing the noise signals produced by the system.
• Controllers can help to speed up the slow response of an overdamped system. [1]
Types of Controllers:
There are two main types of controllers:
• Continuous controllers.
• Discontinuous controllers.
Discontinuous Controller:
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.
Discontinuous controllers operate on very simple, switching final controlling elements.
[1]
Course Instructor: Engr. Wahad Ur Rahman

1
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Continuous Controller:
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.
Basically, there are three basic modes on which the whole control actions take place.
• Proportional Controllers.
• Integral Controllers.
• Derivative Controllers.
By combining above three controllers, we can get:
• Proportional and integral controllers (PI Controller)
• Proportional and derivative controllers (PD Controller)
• Proportional integral derivative control (PID Controller) [1]
Objectives of Controller:
• Decrease the maximum overshot
• Reduce the rise time
• Reduce the settling time
• Reduce steady state error
Proportional Controller:
As the name suggests in a proportional controller the output (also called the actuating
signal) is directly proportional to the error signal. Now let us analyze the proportional
controller mathematically. As we know in proportional controller output is directly
proportional to the error signal, writing this mathematically we have,
Output = Proportional Controller x Error Signal
U(S) = KP X E(S)
U(s) is the Laplace transform of the actuating signal u(t)
E(s) is the Laplace transform of the error signal e(t)
KP is the proportionality constant

Figure 9:1: Block Diagram of proportional controller

Course Instructor: Engr. Wahad Ur Rahman

2
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

PI Controller:
A P.I Controller is a feedback control loop that calculates an error signal by taking the
difference between the output of a system, which in this case is the power being drawn
from the battery, and the set point. The set point is the level at which we’d like to have
our system running. The proportional integral controller is used to decrease the steady
state error without affecting the stability of the control system. [2]

𝑢(𝑡) = 𝐾𝑝 𝑒(𝑡) + 𝐾𝑖 ∫ 𝑒(𝑡)𝑑𝑡

The Laplace transform is


𝑈(𝑆) 𝐾𝐼
= 𝐾𝑃 +
𝐸(𝑆) 𝑆

Figure 9:2: Block Diagram of PI controller [2]


PD Controller:
The proportional derivative controller produces an output, which is the combination of
the outputs of proportional and derivative controllers. The proportional derivative
controller is used to improve the stability of control system without affecting the steady
state error. [2]
Mathematically we have,
𝑑𝑒(𝑡)
𝑢(𝑡) = 𝐾𝑝 𝑒(𝑡) + 𝐾𝑑
𝑑𝑡
The Laplace transform is
𝑈(𝑆)
= 𝐾𝑃 + 𝐾𝑑 𝑆
𝐸(𝑆)

Course Instructor: Engr. Wahad Ur Rahman

3
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Figure 9:3: Block Diagram of PD controller [2]


Comparison of P, PI, and PD controller:
Table 9:1: Comparison of P, PI, and PD Controller
CL Response Rise Time Overshoot Settling Time SS Error
Kp Decreases Increases Small Change Decreases
Ki Decreases Increases Increases Eliminate
Kd Small Change Decreases Decreases Small Change
Proportional, Derivative, and Integral (PID) Controller:
A PID controller is an instrument used in industrial control applications to regulate
temperature, flow, pressure, speed and other process variables. PID (proportional
integral derivative) controllers use a control loop feedback mechanism to control
process variables and are the most accurate and stable controller. [3]

Figure 9:4: Block Diagram of PID Controller [3]

Course Instructor: Engr. Wahad Ur Rahman

4
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Modeling of Mass Spring Damper System:

Figure 9:5: Mass Spring Damper System


𝑋(𝑆) 1
The transfer function of the system is 𝐹(𝑆) = 𝑆2 +10𝑆+20

Lets take the values are m = 1, b = 10, k = 20

In Lab Task:
Procedure:
• Consider the mass spring system.
• Create the .m file
• Simulate the step response of the system without PID controller.
• Calculate the SS error from initial value and final value.
• Apply the PD and PID controller to reduce the steady state error.
• Keep changing the value of Kp and Ki value for PI controller.
• Apply the PID controller.
• Open the Simulink and model the system in Simulink.
• First model it without PID and PD controller and then with PID and PD controller.
• Analyze the response before and after PID controller.
• Simulate it for different values of proportional constant Kp, Kd and Ki.
Consider a process to be controlled by PID controller,
𝟒𝟎𝟎
𝑮𝒑 =
𝑺(𝑺 + 𝟒𝟖. 𝟓)
Part (a): Obtain the unit step response of 𝑮𝒑 (𝒔)

Figure 9:6: Model of Step response of system


Course Instructor: Engr. Wahad Ur Rahman

5
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Figure 9:7: Step response of system


Part (b): Try PI controllers with (Kp = 2, 10, 100), and Ki = Kp/10. Investigate the unit
step response in each case, compare the results and comment

Code in .m file:
num = [400] %numerator
denum = [1 48.5 0] %denumerator
system = tf(num, denum) %transfer function
step(system)
stepinfo(system) %characterisitics of step response

kp1 = 2; %When Proportional const value is 2


ki1 = 0.2; %When Integral const value is 0.2
c1 = pid(kp1,ki1,0);
T1 = feedback(c1*system,1);

kp2 = 10; %When Proportional const value is 10


ki2 = 1; %When integrl const value is 1
c2 = pid(kp2,ki2,0);
T2 = feedback(c2*system,1);

kp3 = 100; %When Proportional const value is 100


ki3 = 10; %When integral const value is 10
c3 = pid(kp3,ki3,0);
T3 = feedback(c3*system,1);
linearSystemAnalyzer(T1,T2,T3)

Course Instructor: Engr. Wahad Ur Rahman

6
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Model in Simulink:

Figure 9:8: Model of PI control of system

Results:

Figure 9:9: Analyzing of system using Linear System Analyzer


Course Instructor: Engr. Wahad Ur Rahman

7
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Figure 9:10: Graphs of system in Simulink


Table 9:2: System characteristics at different values of Kp and Ki
Proportional Integral Rise overshoot Settling Steady SS
Gain Kp Gain Ki Time Time State Error
Value
2 0.2 0.0943 1.13 0.0147 1 0
10 1 0.0027 27.3 0.167 1 0
100 10 0.00573 68.2 0.16 1 0

Part (C): Let Kp = 100, Ki = 10, and add a derivative term with (Kd = 0.1,0.9,0.2).
Investigate the unit step response in each case, compare the results and comment

Code in .m file:
num = [400] %numerator
denum = [1 48.5 0] %denumerator
system = tf(num, denum) %transfer function
step(system)
stepinfo(system) %characterisitics of step response

Course Instructor: Engr. Wahad Ur Rahman

8
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

kp1 = 100; %When Proportional const value is 2


ki1 = 10; %When Integral const value is 0.2
kd1 = 0.1; %When derivative const value is 0.1
c1 = pid(kp1,ki1,kd1);
T1 = feedback(c1*system,1);

kp2 = 10; %When Proportional const value is 10


ki2 = 1; %When integrl const value is 1
kd2 = 0.9; %When derivative const value is 0.9
c2 = pid(kp2,ki2,kd2);
T2 = feedback(c2*system,1);

kp3 = 100; %When Proportional const value is 100


ki3 = 10; %When integral const value is 10
kd3 = 2; %When derivative const value is 2
c3 = pid(kp3,ki3,kd3);
T3 = feedback(c3*system,1);
linearSystemAnalyzer(T1,T2,T3)

Model in Simulink:

Figure 9:11: Model of Step response of system

Course Instructor: Engr. Wahad Ur Rahman

9
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Results:

Figure 9:12: Analyzing of System using Linear System Analyzer

Figure 9:13: Graphs of system in Simulink


Course Instructor: Engr. Wahad Ur Rahman

10
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester

Table 9:3: System characteristics at different values of Kp, Ki, and Kd


Integral Steady
Proportional derivative Rise SS
Gain overshoot Settling State
Gain Kp gain Time Error
Ki Time Value
100 10 0.1 0.00597 49.9 0.0839 1 0
100 10 0.9 0.0107 0.0373 0.156 1 0
100 10 2 0.00273 0 0.0048 1 0

Discussion:
We model the system that was given in task. But there was a lot of unwanted offsets, low
accuracy and instability. So we use the proportional controller PI, and PID controller to remove
unwanted offsets, gain more stability and accuracy. Also rise time were decreasing but peak
amplitude were increasing. By increasing Kp, we got more fluctuations. From Table 9.2 and
figure 9.10 or 9.13, we are seeing the rise time increases, overshoot decreases, and settling time
decreases. While increasing of Kp and Ki, the overshoot increases, rise time decreases, and
also will take more time to settle down.. From Table 9.3 and figure 9.12 or 9.13, we are seeing,
by increasing Kd, Rise time decreases, no overshoot, and also reaches fast to settling time. So,
the system with Kp = 100, Ki = 10, Kd = 2 is better among all the cases.

References

[1] [Online]. Available: https://www.electrical4u.com/types-of-controllers-proportional-


integral-derivative-controllers/.

[2] [Online]. Available:


https://www.tutorialspoint.com/control_systems/control_systems_controllers.htm.

[3] [Online]. Available: https://drstienecker.com/tech-332/7-pid-control/.

Course Instructor: Engr. Wahad Ur Rahman

11

You might also like