Lab10 CS
Lab10 CS
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
Lab No: 9
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.
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
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]
3
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
4
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
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 𝑮𝒑 (𝒔)
5
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
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
6
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
Model in Simulink:
Results:
7
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
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
8
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
Model in Simulink:
9
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
Results:
10
DEPARTMENT OF MECHATRONICS ENGINEERING
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, PESHAWAR
MtE-328L Control system LAB, 6th Semester
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
11