PID Tuning via Ziegler Nichols Method
304 views (last 30 days)
Show older comments
Hi all, I am trying to tune a PID using the Ziegler NIchols method, here is the transfer function :

I started following this video : https://www.youtube.com/watch?v=n829SwSUZ_c&t=1400s&ab_channel=ChristopherLum . I got to the part where he obtains the ultimate gain Ku from simulink. He set Kd=Ki=0 and only increased Kp until he got neutral oscilations. My problem is this : my value for "Ku" is 1.745 and my response looks like this :

And if I zoom in the waveform looks like this :

Which look nothing alike the waveforms I have seen online. Now if I increase my Kp above 1.8 the response of the system looks like this :

Now my question is: what am I doing wrong ? If I use that value for Ku=1.745 and continue with the calculations the response looks like this :

Which looks pretty wrong. So what I am doing wrong ? also if i try in matlab to plot the system response i get this plot :

Below is my block scheme and step input settings :

0 Comments
Accepted Answer
Sam Chak
on 12 Jan 2024
Hi @Tom
If my recollection serves me right, the Ziegler–Nichols method requires the process plant to be open-loop stable. However, in the case of your plant,
, it is open-loop unstable due to a pole at the origin. To enable the application of the Ziegler–Nichols method, we aim to create a form of 'open-loop stability' from a tuning standpoint by establishing a feedback loop utilizing the original plant's output. I've denoted this modified plant as
, and now the Ziegler–Nichols method can be implemented effectively.
%% Plant (open-loop unstable)
Gp = tf(523500, [1 87.35 10470 0])
%% Plant (make it open-loop stable)
Gpp = feedback(Gp, 1)
step(Gpp, 1), grid on
%% Ziegler–Nichols Gains
Ku = 0.747; % Find this Ultimate Gain
G = minreal(feedback(Ku*Gpp, 1));
step(G, 1), grid on
[y, t] = step(G, 1);
h = detrend(y);
[~, peaks] = findpeaks(h, 'MinPeakProminence', (max(h)-min(h))/4);
Tu = mean(diff(t(peaks))) % Oscillation period
%% Classic PID Controller synthesis from Z–N Table
Kp = 0.6*Ku;
Ti = Tu/2;
Td = Tu/8;
Ki = Kp/Ti;
Kd = Kp*Td;
Gc = pid(Kp, Ki, Kd)
%% Closed-loop system
Gcl = minreal(feedback(Gc*Gpp, 1))
stepinfo(Gcl)
step(Gcl, 1), grid on
4 Comments
Siddharth Jawahar
on 22 Nov 2024
Edited: Siddharth Jawahar
on 22 Nov 2024
% Define the transfer function
s = tf('s'); % Define Laplace variable
G = 523500 / (s^3 + 87.35*s^2 + 10470*s); % Plant transfer function
% Set PID tuning options for balanced response
opts = pidtuneOptions('DesignFocus', 'balanced');
% Use pidtune to tune the PID controller with the specified options
[C, info] = pidtune(G, 'PID', opts);
% Display the tuned PID controller parameters
disp('Tuned PID Controller with Balanced Design Focus:');
disp(C);
% Display closed-loop performance metrics
disp('Tuning Info:');
disp(info);
% Analyze closed-loop response
T = feedback(C * G, 1); % Closed-loop transfer function
figure;
step(T); % Step response of the closed-loop system
grid on;
title('Closed-Loop Step Response');
Hope this helps,
Sid
More Answers (2)
Sam Chak
on 12 Jan 2024
Hi @Tom
Regarding your original issue, you can improve the display of the waveform from the Simulink Scope by reducing the maximum step size in the Configuration Parameters dialog box. In the Simulink Editor, on the Modeling tab, click Model Settings.


By the way, I attempted to implement the Ziegler–Nichols tuning method on the initial unstable plant by determining the ultimate gain (
) until the output displays sustained oscillations. Surprisingly, the Ziegler–Nichols method, employing the 'some overshoot' criterion, successfully stabilizes the plant. However, it is noteworthy that the overshoot in this case amounts to 30%.
%% Plant (open-loop unstable)
Gp = tf(523500, [1 87.35 10470 0])
ToF = isstable(Gp) % 1 means stable, 0 means unstable
%% Ziegler–Nichols Gains
Ku = 1.747; % Find this Ultimate Gain
G = minreal(feedback(Ku*Gp, 1));
step(G, 1), grid on
[y, t] = step(G, 1);
h = detrend(y);
[~, peaks] = findpeaks(h, 'MinPeakProminence', (max(h)-min(h))/4);
Tu = mean(diff(t(peaks))) % Oscillation period
%% PID Controller synthesis with 'Some Overshoot' from Z–N Table
Kp = Ku/3;
Ti = Tu/2;
Td = Tu/3;
Ki = Kp/Ti;
Kd = Kp*Td;
Gc = pid(Kp, Ki, Kd)
%% Closed-loop system
Gcl = minreal(feedback(Gc*Gp, 1))
stepinfo(Gcl)
step(Gcl, 1), grid on
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




