Lecture 11 Control
Lecture 11 Control
ON-OFF Control
PID Controller
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).
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'])
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'])
P 0.5Kc - -
PI 0.45Kc Pc/1.2 -
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()
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()