Finding Kp,Ti,Td with PID tuner

26 次查看(过去 30 天)
Esin Derin
Esin Derin 2022-6-25
回答: Sam Chak 2022-6-28
Hello, I'm trying to find and built a PID system.But it gets error.
P=4;
bode(P)
I=tf([1],[5]);
bode(I);
D=9;
bode(D);
sys=tf([270 50 1],[225 5 0])
[C_pi,info]=pidtune(sys,'PI')
[C_p,info]=pidtune(sys,'P')
bode(sys)
nyquist(sys)
[C_PD,info]=pidtune(syz,'PID')
I have to find,reponse time,steady stae error,overshot from Kp,Ki,Td.Function I have to work with is (1/s^2+10s+20).
Tune controller is in this sequence;
1.Only P element
2.Enable D, and returne P
3.Enable I and retune P,D.
And I have to plot, P,I,D,PI,PD,PID, bode and nyquist graphs.

回答(1 个)

Sam Chak
Sam Chak 2022-6-28
Kind of remember seeing a similar question few days ago. Probably your classmate. Anyway, this is how you can plot the step response of a closed-loop system.
Question 1:
% Plant
Gp = tf(1, [1 10 20])
Gp = 1 --------------- s^2 + 10 s + 20 Continuous-time transfer function.
% Question 1
[Gc1, info] = pidtune(Gp, 'P')
Gc1 = Kp = 94.9 P-only controller.
info = struct with fields:
Stable: 1 CrossoverFrequency: 8.2132 PhaseMargin: 60.0248
% Closed-loop system
Gcl1 = minreal(feedback(Gc1*Gp, 1))
Gcl1 = 94.86 ------------------ s^2 + 10 s + 114.9 Continuous-time transfer function.
step(Gcl1, 3) % steady-state error between 0.8 and 1.0 is significant.
% bode(Gcl1)
% nyquist(Gcl1)
Question 2:
% Question 2
[Gc2, info] = pidtune(Gp, 'PD')
Gc2 = Kp + Kd * s with Kp = 1.22e+03, Kd = 30.6 Continuous-time PD controller in parallel form.
info = struct with fields:
Stable: 1 CrossoverFrequency: 41.6138 PhaseMargin: 60.0000
% Closed-loop system
Gcl2 = minreal(feedback(Gc2*Gp, 1))
Gcl2 = 30.62 s + 1216 -------------------- s^2 + 40.62 s + 1236 Continuous-time transfer function.
step(Gcl2, 3) % response is super fast and steady-state error is reduced substantially 1 - 1216/1236, but overshoot is relatively high
% bode(Gcl2)
% nyquist(Gcl2)
Question 3:
% Question 3
[Gc3, info] = pidtune(Gp, 'PID')
Gc3 = 1 Kp + Ki * --- + Kd * s s with Kp = 39.3, Ki = 116, Kd = 3.33 Continuous-time PID controller in parallel form.
info = struct with fields:
Stable: 1 CrossoverFrequency: 4.1614 PhaseMargin: 74.0404
% Closed-loop system
Gcl3 = minreal(feedback(Gc3*Gp, 1))
Gcl3 = 3.326 s^2 + 39.27 s + 115.9 --------------------------------- s^3 + 13.33 s^2 + 59.27 s + 115.9 Continuous-time transfer function.
step(Gcl3, 3) % no steady-state error and the overshoot is reduced. Response settles under 2 seconds.
% bode(Gcl3)
% nyquist(Gcl3)

类别

Help CenterFile Exchange 中查找有关 Get Started with Control System Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by