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

Lecture 11 Control

Uploaded by

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

Lecture 11 Control

Uploaded by

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

Open Loop Control System

Closed Loop/ Feedback Control System

Digital Control System

ON-OFF Control
PID Controller

The output of PID controller is given by:


u(t) = Kp x e(t) + Ki x integral{e(t)} + Kd x derivative {e(t)}
where, e(t) is the error input,
Kp = proportional gain,
Ki = integral gain, and
Kd = derivative gain.
The Laplace transform of the PID controller is given by:
U(s) = Kp + Ki/s + Kd.s

Closed Loop Response


Increase in Rise Time Overshoot Settling Time Steady State Error

Kp Decrease Increase Small Change Decrease


Ki Decrease Increase Increase Decrease

Kd Small Change Decrease Decrease No Change


Steps to obtain a desired response

Obtain an open-loop response and determine what needs to be improved.


Add a proportional control to improve the rise time.
Add a derivative control to reduce the overshoot.
Add an integral control to reduce the steady-state error.
Adjust each of the gains Kp, Ki, and Kd until you obtain a desired overall response.

1 !pip install control

1 import control.matlab as ctl


2 import matplotlib.pyplot as plt
3 import numpy as np

Transfer function of Mass-damper-dashpot system

Step response of the system

1 m, c, k = 1, 5, 20 # mass, damping coefficient, spring constant


2
3 s = ctl.tf([1, 0], 1) # define operator 's' in laplace domain
4
5 Gs = 20/(m*s**2 + c*s + k) # create transfer function (multiplied by 20 to normalize)
6
7 T = np.arange(0, 5, 0.01)
8 U = np.ones(len(T))
9 yout, T, xout = ctl.lsim(Gs,U,T)
10 plt.plot(T, yout, T, U)
11 plt.grid()
12 plt.xlabel('Time ->')
13 plt.ylabel('Amplitude ->')
14 plt.title('Step response')
15 plt.legend(['Output response','Step input'])
/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: return_x
"return_x specified for a transfer function system. Internal "
<matplotlib.legend.Legend at 0x7f796a556e90>

RiseTime — Time it takes for the response to rise from 10% to 90% of the steady-state response.

SettlingTime — Time it takes for the error e(t) = |y(t) – yfinal| between the response y(t) and the
steady-state response yfinal to fall below 2% of the peak value of e(t).

SettlingMin — Minimum value of y(t) once the response has risen.

SettlingMax — Maximum value of y(t) once the response has risen.

Overshoot — Percentage overshoot, relative to yfinal.


Undershoot — Percentage undershoot.

Peak — Peak absolute value of y(t)

PeakTime — Time at which the peak value occurs.

1 Kp, Ki, Kd = 0, 0, 0
2 for Kp in [1, 3, 10]:
3 Cs = Kp + Ki/s + Kd*s
4 Ms = ctl.feedback(Cs*Gs, 1)
5 yout, T, xout = ctl.lsim(Ms,U,T)
6 plt.plot(T,yout)
7 plt.grid()
8 plt.legend(['Kp=1','Kp=3','Kp=10'])

/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: return_x


"return_x specified for a transfer function system. Internal "
/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: return_x
"return_x specified for a transfer function system. Internal "
/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: return_x
"return_x specified for a transfer function system. Internal "
<matplotlib.legend.Legend at 0x7f796a5d1950>

1 Kp, Ki, Kd = 3, 0, 0
2 for Ki in [1, 3, 10]:
3 Cs = Kp + Ki/s + Kd*s
4 Ms = ctl.feedback(Cs*Gs,1)
5 yout, T, xout = ctl.lsim(Ms,U,T)
6 plt.plot(T,yout)
7 plt.grid()
8 plt.legend(['Ki=1','Ki=3','Ki=10'])

1 Kp, Ki, Kd = 3, 3, 0
2 for Kd in [1, 3, 10]:
3 Cs = Kp + Ki/s + Kd*s
4 Ms = ctl.feedback(Cs*Gs,1)
5 yout, T, xout = ctl.lsim(Ms,U,T)
6 plt.plot(T,yout)
7 plt.grid()
8 plt.legend(['Kd=1','Kd=3','Kd=10'])

Steps to obtain a desired response

Obtain an open-loop response and determine what needs to be improved.


Add a proportional control to improve the rise time.
Add a derivative control to reduce the overshoot.
Add an integral control to reduce the steady-state error.
Adjust each of the gains Kp, Ki, and Kd until you obtain a desired overall response.

Ziegler-Nichols tuning, using the oscillation method


In Ziegler-Nichols tuning Ki and Kd are set to zero and Kp is increased until the loop starts to
oscillate. Once oscillation starts, the critical gain Kc and the period of oscillations Pc are noted.
The Kp, Ki=Kp/Ti and Kd=Kp.Td are then adjusted as per the tabular column shown below.
Controllerer Kp Ti Td

P 0.5Kc - -

PI 0.45Kc Pc/1.2 -

PID 0.60Kc 0.5Pc Pc/8

1 Kp, Ki, Kd = 0, 0, 0
2 for Kp in [1, 3, 10]:
3 Cs = Kp + Ki/s + Kd*s
4 Ms = ctl.feedback(Cs*Gs, 1)
5 yout, T, xout = ctl.lsim(Ms,U,T)
6 plt.plot(T,yout)
7 plt.grid()
8 plt.legend(['Kp=1','Kp=3','Kp=10'])
/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: retur
"return_x specified for a transfer function system. Internal "
/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: retur
"return_x specified for a transfer function system. Internal "
/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: retur
"return_x specified for a transfer function system. Internal "
<matplotlib.legend.Legend at 0x7f796a517e10>

1 Kc = 3 # critical gain
2 Pc = 1/1.5 # period of oscillation

1 # PI Controller
2 Kp = 0.45 * Kc
3 Ti = Pc/1.2
4 Ki = Kp/Ti
5 Kd = 0
6 Cs = Kp + Ki/s + Kd*s
7 Ms = ctl.feedback(Cs*Gs, 1)
8 yout, T, xout = ctl.lsim(Ms,U,T)
9 plt.plot(T,yout)
10 plt.grid()

/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: retur


"return_x specified for a transfer function system. Internal "

1 # PID Controller
2 Kp = 0.6 * Kc
3 Ti = Pc/2
4 Td = Pc/8
5 Ki = Kp/Ti
6 Kd = Kp*Td
7 Cs = Kp + Ki/s + Kd*s
8 Ms = ctl.feedback(Cs*Gs, 1)
9 yout, T, xout = ctl.lsim(Ms,U,T)
10 plt.plot(T,yout)
11 plt.grid()

/usr/local/lib/python3.7/dist-packages/control/timeresp.py:294: UserWarning: retur


"return_x specified for a transfer function system. Internal "

You might also like