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

LAB07-1

Cnc milling

Uploaded by

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

LAB07-1

Cnc milling

Uploaded by

Ameer Hamza
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Control Engineering Lab

Experiment No 7:
Design and analyze the performance parameter of
PID controller

OBJECTIVE
 Study the three term (PID) controller and its effects on the feedback loop response.
Investigate the characteristics of the each of proportional (P), the integral (I), and the
derivative (D) controls, and how to use them to obtain a desired response.

THEORY
A proportional-integral-derivative controller (PID controller) is a control loop
feedback mechanism (controller) widely used in industrial control systems. A PID
controller calculates an error value as the difference between a measured process
variable and a desired set point. The controller attempts to minimize the error by
adjusting the process through use of a manipulated variable. The PID controller
algorithm involves three separate constant parameters, and is accordingly sometimes
called three-term control. the proportional, the integral and derivative values, denoted
P, I, and D. Simply put, these values can be interpreted in terms of time: P depends on
the present error, I on the accumulation of past errors, and D is a prediction of future
errors, based on current rate of change. The weighted sum of these three actions is
used to adjust the process via a control element such as the position of a control
valve, a damper, or the power supplied to a heating element.
Consider the following unity feedback system as shown in Figure 1.

Figure 1: Feedback system

Plant: A system to be controlled.


Controller: Provides excitation for the plant; Designed to control the overall system
behaviour. The three-term controller: The transfer function of the PID controller
looks like the following:

KP = Proportional gain
KI = Integral gain
KD = Derivative gain
First, let's take a look at how the PID controller works in a closed-loop system using
the Schematic shown above. The variable (e) represents the tracking error, the
difference between the desired input value (R) and the actual output (Y). This error
signal (e) will be sent to the PID controller, and the controller computes both the

1
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

derivative and the integral of this error signal. The signal (u) just past the controller is
now equal to the proportional gain (K P) times the magnitude of the error plus the
integral gain (KI) times the integral of the error plus the derivative gain (K D) times the
derivative of the error.

This signal (u) will be sent to the plant, and the new output (Y) will be obtained. This
new output (Y) will be sent back to the sensor again to find the new error signal (e).
The controller takes this new error signal and computes its derivatives and it’s
internal again. The process goes on and on.
Proportional Term
The proportional term produces an output value that is proportional to the current
error value. The proportional response can be adjusted by multiplying the error by a
constant Kp, called the proportional gain constant. The proportional term is given by

A high proportional gain results in a large change in the output for a given change in
the error. If the proportional gain is too high, the system can become unstable. In
contrast, a small gain results in a small output response to a large input error, and a
less responsive or less sensitive controller. If the proportional gain is too low, the
control action may be too small when responding to system disturbances. Tuning
theory and industrial practice indicate that the proportional term should contribute the
bulk of the output change.

Figure 1

Integral Term

The contribution from the integral term is proportional to both the magnitude of the
error and the duration of the error. The integral in a PID controller is the sum of the
instantaneous error over time and gives the accumulated offset that should have been
corrected previously. The accumulated error is then multiplied by the integral gain K I
and added to the controller output.

2
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

The integral term accelerates the movement of the process towards set-point and
eliminates the residual steady-state error that occurs with a pure proportional
controller. However, since the integral term responds to accumulated errors from the
past, it can cause the present value to overshoot the set-point value.

Figure 2

Derivative Term
The derivative of the process error is calculated by determining the slope of the error
over time and multiplying this rate of change by the derivative gain K D The
magnitude of the contribution of the derivative term to the overall control action is
termed the derivative gain, KD. The derivative term is given by

Derivative action predicts system behavior and thus improves settling time and
stability of the system. An ideal derivative is not causal, so that implementations of
PID controllers include an additional low pass filtering for the derivative term, to
limit the high frequency gain and noise. Derivative action is seldom used in practice
though by one estimate in only 20% of deployed controllers because of its variable
impact on system stability in real-world applications.

Figure 3

3
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

Example 1:
We assume the mass is traveling toward the right. Thus, only the applied
force points to the right; all other forces impede the motion and act to oppose it. Hence,
the spring, viscous damper, and the force due to acceleration point to the left.

Figure 4

X (s) 1
G(s)= =
F (s) M s + f v s + K
2

Now let’s apply Proportional control to the above system and analyze the output.

CODE:
clear
num=[1];
den=[1 30 15];
sys_ol=tf(num,den)
kp1=5;kp2=30;kp3=100
num1=[kp1];num2=[kp2];num3=[kp3]
den=[5 0];
Gc1=tf(num1,den);Gc2=tf(num2,den);Gc3=tf(num3,den);
sys_cl1=feedback(sys_ol*Gc1,1);sys_cl2=feedback(sys_ol*Gc2,1);sys_cl3=feedback(sys_ol*Gc
3,1); step(sys_cl1,sys_cl2,sys_cl3))

GRAPH:

4
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

Example 2:
5
Let assume the plant transfer function in below .
( s+1)( s+2)(s+3)

Figure 5
GRAPH:
PI:

Figure 6

PD:

5
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

PID:

Figure 7

MATLAB CODE:
clear
num=[5];
den=[1 6 11 6];
sys_ol=tf(num,den)
roots=zpk(sys_ol)
sys_cl=feedback(sys_ol,1)
% Design of PI controller..........................................
[Gc_PI, info_PI]=pidtune(sys_ol,'PI')
sys_clf=feedback(sys_ol*Gc_PI,1)
step(sys_cl,sys_clf)
% Design of PD controller..........................................
[Gc_PD, info_PD]=pidtune(sys_ol,'PD')
sys_clf=feedback(sys_ol*Gc_PD,1)
step(sys_cl,sys_clf)
% Design of PID controller..........................................
[Gc_PID, info_PID]=pidtune(sys_ol,'PID')
sys_clf=feedback(sys_ol*Gc_PID,1)
step(sys_cl,sys_clf))

Characteristics of P, I, and D controllers:


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

6
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

worse. A derivative control (KD) will have the effect of increasing the stability of the
system, reducing the overshoot and improving the transient response.
Effect of each controller KP, KI and KD on the closed-loop system are summarized below
in Table 1.
Table 1: Effects of Kp, Ki & Kd

Note that these corrections may not be accurate, because KP, KI, and KD are dependent of
each other. In fact, changing one of these variables can change the effect of the other two.
For this reason the table should only be used as a reference when you are determining the
values for KP, KI, and KD.

Lab Tasks
Q1: Consider a process given below to be controlled by a Proportional controller. Show
the desired output of controller by executing the Matlab command when unit step input is
applied. Record percent overshoot, settling time, peak time, and rise time. Use different
values of Kp.

Figure 8

7
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

Q2: Consider a process given below to be controlled by a Proportional and Integral


controller. Design the Integral control and PI control to yield a closed-loop step response
with overshoot less than 10%, settling time 5 sec and rise time less than 2 sec separately.
Show the desired output of controller by executing the Matlab command when unit step
input is applied. Record percent overshoot, settling time, peak time, and rise time

Figure 9

Q3: Show the following tasks using Matlab.


1. Design a PI Controller to yield a closed-loop step response with overshoot less than
10% and settling time less than 11 sec.
2. Design a PD Controller to yield a closed-loop step response with overshoot less than
20% and settling time less than 3 sec.
3. Design a PID Controller to yield a closed-loop step response with overshoot less than
5% and settling time less than 5 sec.

Figure 10

8
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

Matlab Code
Question 1)
clc
clear all
plant=tf([40],[3 24 51 30])
sysa=feedback(plant,1)
step(sysa)
( Open PID Tuner tab via “pidTuner” in commad Window and Proceed to Tune
Respective Proportional Controller )
Question 2)
clc
clear all
plant=tf([1],[1 0 4])
sysa=feedback(plant,1)
step(sysa)
( Open PID Tuner tab via “pidTuner” in commad Window and Proceed to Tune
Respective Controller or Controllers )
The best tuned values are given by the PIDF ( Proportional Integral Derivative Filter )
controller.
Question 3)
clc
clear all
plant=tf([0.00027],[1 0.17 0.008 0.0001])
sysa=feedback(plant,1)
step(sysa)
( Open PID Tuner tab via “pidTuner” in commad Window and Proceed to Tune
Respective Controller or Controllers )

9
Department of Mechanical Engineering, Air University A&AC Kamra
Control Engineering Lab

Controller Kp,Ki,Kd Settling Time Overshoot %

Kp= 0.13248
PI 204 s 1.51 %
Ki= 0.02099
Kp= 39.2024
PD 56.7 s 79.6 %
Kd= 2656.4571
Kp= 1.249
PID Ki= 0.0316 219 s 0%
Kd= 12.3134

Analysis
In question 1, the effect of proportional controller was shown by varying values of Kp
which results in faster response time of the system but increases the overshoot of the
system thus increasing the settling time.
In question 2, the best controller for this closed loop system was found out to be PIDF
resulting in over shoot of 5.51 % with rise time and settling time of 0.182 seconds and
5.53 seconds respectively.
In question 3, the best possible results for each controller have been conveyed in the
above table from which we either get reduced overshoots with large settling times or
large overshoots with small settling times.
Conclusion

10
Department of Mechanical Engineering, Air University A&AC Kamra

You might also like