How do I code Ziegler-Nichols Tuning Method to find PID control constants?

50 ビュー (過去 30 日間)
ieng100
ieng100 2013 年 4 月 24 日
回答済み: Sam Chak 2024 年 7 月 7 日
I need to use the Ziegler-Nichols Tuning rules to determine the PID control constants for the following system to meet a settling time ts ≤ 5 sec, an overshoot of Mp ≤ 50%, and zero steady state error to a unit step function input.
System: PID control = Kp((Ti*Td*s^2+Ti*s+1)/(Ti*s))
And plant open loop transfer function = 10/(2*s^3+12*s^2+22*s+12)
PID control and plant function are in series with negative feedback loop.
For PID control tuning rules are as follows, Kp=0.6*Kr, Ti=0.5*Pcr, Td=0.125*Pcr
I appreciate your help.
  3 件のコメント
kerem
kerem 2024 年 3 月 13 日
transfer fonksiyonu verilen bir sistem için PID katsayıları nasıl belirleyebilirim?
Sam Chak
Sam Chak 2024 年 3 月 13 日
I suggest posting a new question and providing the transfer function of the given Plant. However, it is important to note that not all types of transfer functions can be stabilized by a PID controller. PID controllers are typically most effective for linear systems of 2nd-order or lower.

サインインしてコメントする。

回答 (1 件)

Sam Chak
Sam Chak 2024 年 7 月 7 日
It is now time to provide a conclusion for this control problem. In the Ziegler-Nichols 2nd method, the critical gain can be determined from the Routh–Hurwitz criterion. Simulating the closed-loop system will cause the output to exhibit sustained oscillations. From the oscillations, the critical period can be found using the findpeaks() command.
While the Ziegler-Nichols-tuned PID gains do not strictly satisfy the settling time requirement, it is possible to employ a heuristic approach to quickly tune the PID gains. However, this heuristic approach may not always lead to the optimal solution.
Ziegler-Nichols Second method
%% Process Plant, Gp
s = tf('s');
Gp = 10/(2*s^3 + 12*s^2 + 22*s + 12)
Gp = 10 -------------------------- 2 s^3 + 12 s^2 + 22 s + 12 Continuous-time transfer function.
%% Find Critical Gain, Kcr (determined by Routh-Hurwitz criterion)
Kcr = 12;
Gc = pid(Kcr);
Gcl = minreal(feedback(Gc*Gp, 1)); % closed-loop system
[y, t] = step(Gcl, 10);
figure(1)
plot(t, y), grid on, xlabel('t'), ylabel('y(t)'), title('Step Response')
%% Find Critical Period, Pcr
[pk, lo]= findpeaks(y, t);
Pcr = lo(2) - lo(1)
Pcr = 1.8894
%% Apply Ziegler-Nichols Tuning Rules
Kp = 0.6*Kcr;
Ti = 0.5*Pcr;
Td = 0.125*Pcr;
%% PID controller in standard form
Gc = pidstd(Kp, Ti, Td)
Gc = 1 1 Kp * (1 + ---- * --- + Td * s) Ti s with Kp = 7.2, Ti = 0.945, Td = 0.236 Continuous-time PID controller in standard form
%% Closed-loop system
Gcl = minreal(feedback(Gc*Gp, 1))
Gcl = 8.502 s^2 + 36 s + 38.11 ------------------------------------- s^4 + 6 s^3 + 19.5 s^2 + 42 s + 38.11 Continuous-time transfer function.
figure(2)
nfo = stepinfo(Gcl);
disp(nfo.SettlingTime)
5.0045
disp(nfo.Overshoot)
44.2727
step(Gp, 10), hold on
step(Gcl, 10), grid on, hold off
xline(nfo.SettlingTime, '--', sprintf('Settling Time: %.3f sec', nfo.SettlingTime), 'color', '#7F7F7F', 'LabelVerticalAlignment', 'bottom')
legend('Original System', 'Closed-loop System', '')
Rational number PID gains
%% PID Controller
kp = 9/10;
ki = 18/25;
kd = 1/8;
Tf = 5/12;
Gc = pid(kp, ki, kd, Tf) % PID controller
Gc = 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 with Kp = 0.9, Ki = 0.72, Kd = 0.125, Tf = 0.417 Continuous-time PIDF controller in parallel form.
Gcl = minreal(feedback(Gc*Gp, 1)) % closed-loop system
Gcl = 6 s^2 + 14.4 s + 8.64 --------------------------------------------------- s^5 + 8.4 s^4 + 25.4 s^3 + 38.4 s^2 + 28.8 s + 8.64 Continuous-time transfer function.
figure(3)
step(Gp), hold on
step(Gcl), grid on
S = stepinfo(Gcl);
xline(S.SettlingTime, '--', sprintf('Settling Time: %.3f sec', S.SettlingTime), 'color', '#7F7F7F', 'LabelVerticalAlignment', 'bottom')
legend('Original System', 'Closed-loop System', '')

カテゴリ

Help Center および File ExchangePID Controller Tuning についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by