You are on page 1of 15

Namal University, Mianwali

Department of Electrical Engineering


EE 361L: Control Systems Lab

Lab 8
To Design PID controller to check the system response using Simulink

Student’s Name Muhammad Ali


Roll No. NIM-BSEE-21-34
Date Performed 08/12/2023
Marks Obtained

Instructor’s signature

Course Instructor Dr Sami Ud Din

Lab Engineer Engr.Faizan


Fall 2023 Control Systems Lab

Table of Contents
Namal University, Mianwali .................................................................................................................. 1
Lab 8 ....................................................................................................................................................... 1
Introduction............................................................................................................................................. 3
Lab Objective: ........................................................................................................................................ 3
Apparatus ................................................................................................................................................ 3
Lab Tasks: ............................................................................................................................................... 4
Question # 1.1: ........................................................................................................................................ 4
Without controller ............................................................................................................................ 4
Theoritical Calculation ................................................................................................................. 4
MATLAB Part .................................................................................................................................. 4
Code: .............................................................................................................................................. 4
Result: ............................................................................................................................................ 5
SIMULINK PART ............................................................................................................................ 5
Circuit: ........................................................................................................................................... 5
Result: ............................................................................................................................................ 5
With PID controller. ......................................................................................................................... 6
Theoritical calculation ...................................................................................................................... 6
MATLAB Part .................................................................................................................................. 6
Code ............................................................................................................................................... 6
Result: ............................................................................................................................................ 6
Simulink Part .................................................................................................................................... 7
Circuit ............................................................................................................................................ 7
Result ............................................................................................................................................. 7
Question # 1.2: ........................................................................................................................................ 8
Theoritical Calculation: ............................................................................................................... 8
Code: .............................................................................................................................................. 9
Result: ............................................................................................................................................ 9
SIMULINK PART .......................................................................................................................... 10
Circuit: ......................................................................................................................................... 10
Result: .......................................................................................................................................... 10
Explanation ................................................................................................................................. 10
Question # 1.3: ...................................................................................................................................... 10

Page2
Fall 2023 Control Systems Lab

MATLAB PART ............................................................................................................................. 11


Theoritical Calculation ............................................................................................................... 11
Code: ............................................................................................................................................ 12
Result: .......................................................................................................................................... 13
SIMULINK PART .......................................................................................................................... 13
Circuit: ......................................................................................................................................... 13
Result: .......................................................................................................................................... 13
Explanation ................................................................................................................................. 14
Conclusion: ........................................................................................................................................... 14

Introduction
PID and PD controllers are two of the most common types of feedback controllers used in control
systems. PID controllers use proportional, integral, and derivative gain terms to adjust the output
of the controller in order to minimize the error between the desired and actual output of the system.
PD controllers use proportional and derivative gain terms to achieve this goal. Simulink is a
graphical modeling environment that can be used to simulate and design control systems. To design
a PI or PD controller in Simulink, you can use the PID Controller block. This block allows you to
specify the proportional, integral, and derivative gains of the controller.

Lab Objective:
 To design Proportional Integral Derivative controller using theoretical calculations.
 To implement Proportional Integral Derivative controller using MATLAB/Simulink.

Apparatus
Computer with installed MATLAB software

Page3
Fall 2023 Control Systems Lab

Lab Tasks:
Question # 1.1:

Without controller
Theoritical Calculation

MATLAB Part
Code:
n=[1];
d=[1 6 26];
G=tf(n,d);
step(G)

Page4
Fall 2023 Control Systems Lab

Result:

SIMULINK PART
Circuit:

Result:

Page5
Fall 2023 Control Systems Lab

With PID controller.


Theoritical calculation

MATLAB Part
Code
n=[50 350 300];
d=[1 356 375 300];
G=tf(n,d);
step(G)

Result:

Page6
Fall 2023 Control Systems Lab

Simulink Part
Circuit

Result

Effect on transient characteristics and steady state error:


The PID controller is a powerful tool for improving the performance of control systems. It can be
used to improve both the transient characteristics and the steady state error of the system.
In the case of the system shown in the image, the PID controller has improved the rise time and
overshoot of the system significantly. It has also eliminated the offset, which means that the steady
state error is now zero.
Overall, the PID controller has had a positive effect on the performance of the system.

Page7
Fall 2023 Control Systems Lab

Question # 1.2:

Theoritical Calculation:

Page8
Fall 2023 Control Systems Lab

Code:
n=[111.27 4855.3];
d=[1 114.27 4855.3];
G=tf(n,d);
step(G)
Result:

Page9
Fall 2023 Control Systems Lab

SIMULINK PART
Circuit:

Result:

Explanation
1. Made a controller to make a system settle quickly (0.07s) without too much (damping ratio
0.82).
2. Checked how the system responded to a sudden change in MATLAB and Simulink, both
worked well
3.The system settled quickly with little damping, just like we wanted.
4.Our controller design worked as planned, making the system behave the way we wanted.
5. This method helps design controllers for other systems too, based on what we want.

Question # 1.3:

P a g e 10
Fall 2023 Control Systems Lab

MATLAB PART
Theoritical Calculation

P a g e 11
Fall 2023 Control Systems Lab

Code:
n=[107.47 4821.47 1000];
d=[1 114.47 4831.47 1000];
G=tf(n,d);
step(G)

P a g e 12
Fall 2023 Control Systems Lab

Result:

SIMULINK PART
Circuit:

Result:

P a g e 13
Fall 2023 Control Systems Lab

Explanation

This task aims to improve the performance of a system with a specific transfer function by
designing a PID controller. The desired improvements include faster settling time, reduced
oscillations, and minimal steady-state error. The solution involves theoretical calculations to
determine optimal PID gains followed by simulations in both MATLAB and Simulink to validate
the controller's effectiveness. This design process ensures the controller meets the specified
requirements and optimizes the system's behavior.

Conclusion:
In this lab I successfully demonstrated the design and evaluation of a PID controller for a control
system. Using theoretical calculations based on desired system performance (settling time and damping
ratio), a PID controller I designed with appropriate gains. The effectiveness of the designed controller
was confirmed through step response analysis in both MATLAB and Simulink, verifying that the
system achieved the desired response characteristics. This lab provided valuable insights into the
practical application of PID controller design and its impact on system behavior. It emphasized the
importance of theoretical calculations, simulation validation, and performance analysis in achieving
optimal control objectives. This methodology serves as a valuable tool for engineers and students to
design and implement PID controllers for various control systems.

P a g e 14
Fall 2023 Control Systems Lab

Lab Rubric

Performance Allocated
Domain Excellent (10) Good (7-9) Satisfactory (4-6) Unsatisfactory (13) Poor (0)
indicator Marks

Outcomes are Outcomes are not


All Outcomes Outcomes are
partially analyzed properly
Cognitive Lab Demonstration are critically partially analyzed / Outcomes are not
but need more analyzed/student
(20%) (C) analyzed in a need minor analyzed
emphasis regarding understanding is
meaningful way. improvement. conclusion. weak.

All tasks
Most tasks Some tasks Most tasks
Task Completion completed All task incomplete
completed correctly completed correctly incomplete or
(P) correctly in or incorrect
in given time in given time incorrect
given time

Psychomotor Correct code but Slightly incorrect Almost Incorrect


Code (P) Correct Code Code not Submitted .
(60%) without explanation code code

Most Some
Output correctly Most of the required
Output/Figures/Plots Output/Figures/Plots Output/Figures/Plots
Output (P) shown with Output/Figures/Plots
displayed with displayed with not displayed
proper labeled not displayed
proper labeled proper labeled

Perform as an
Actively perform as Partially perform as Does not perform
Affective individual or in a Have not attend the
Discipline (A) an individual or in a an individual or in a any task individual
(20%) group with lab session
group group or in a group
enthusiasm

You might also like