How can I adjust a controller?
조회 수: 3 (최근 30일)
이전 댓글 표시
I am trying to adjust a controller according to the method above.
I can't understand the how to apply this method, this is what I've tried to do so far.
Output1 = initial signal
Output2 = Kp reaches ultimate gain Ku at which the output of the control loop has stable and consistent oscillations.
Output3 = I set the parameters.
댓글 수: 0
채택된 답변
Ced
2016년 3월 28일
편집: Ced
2016년 3월 29일
Hi
Your basic procedure is correct, but you mixed up the parameters a bit. I admit that this is a bit confusing, but the structure that the Ziegler-Nichols table is written for is
C(s) = Kp*(1+1/(s*Ti)+s*Td)
I.e. you get Ti and Td, and not Ki and Kd.
Your measured values seem a bit off btw, did you read them from the plot?
You can check the exact values with e.g. the margin command, which gives you the gain margin and the corresponding frequency (i.e. your Ku and Tu). Note that the frequency will be given in rad/s and not Hz, so you need to convert that.
You should also be aware that ZN is a heuristic method, and will not work or return meaningful results for arbitrary plants.
Here a small script to compute the Ziegler Nichols Parameters for a system (programmatically, not with simulink):
% Ziegler nychols example
clear all
close all
clc
% spring damper system with eigenfrequency at 10 rad/s and additional
% rolloff --> Ziegler Nichols returns huge overshoot
M = 1;
D = 8;
K = 100;
% P = tf(90,[M D K])*tf(1,[0.015 1]);
% Better behaved:
s = tf('s');
P = 1/(s+1)^5;
% get gain margin
[ Ku, ~, WKu, ~ ] = margin(P);
fKu = WKu/(2*pi);
Tu = 1/fKu;
fprintf('Limit Kp: %g, Period: %g [s]\n',Ku,Tu)
%%Generate a few PID controllers for comparison
Kn = 0.01; % selecting "real" PID like in your simulation
% select some slow gains
Kp0 = 0.4;
Ki0 = 0.1;
Kd0 = 0.1;
C_PID_0 = pid(Kp0,Ki0,Kd0,Kn);
% set Kp gain limit
Kplim = 0.9*Ku;
Kilim = 0;
Kdlim = 0;
C_PID_lim = pid(Kplim,Kilim,Kdlim,Kn);
% set Ziegler Nichols gains
KpZN = 0.6*Ku;
TiZN = 0.5*Tu;
KiZN = KpZN/TiZN;
TdZN = 0.125*Tu;
KdZN = KpZN*TdZN;
C_PID_ZN = pid(KpZN,KiZN,KdZN,Kn);
fprintf('Ziegler Nichols Parameters:\n')
fprintf('Kp: %g, Ki: %g [s], Kd: %g [s]\n',KpZN,KiZN,KdZN);
%%Close the loop
G0 = feedback(P*C_PID_0,1);
G1 = feedback(P*Kplim,1);
G2 = feedback(P*C_PID_ZN,1);
%%Check Nyquist plot
figure(1)
nyquist(P*C_PID_0,P*C_PID_lim,P*C_PID_ZN)
grid on
axis([ -2.8419 3.6822 -4.7619 4.3024 ])
legend('low gains','limit','Ziegler Nichols')
%%Plot
figure(2)
step(G0,G2)
ylim([- 2 2 ])
legend('Low Gains','Ziegler Nichols','Location','SouthEast')
Cheers
EDIT: typo in ZN gain calculation, fixed
댓글 수: 5
Ced
2016년 4월 6일
Yes, I meant using x = [ X1 dX1 E dE ] as your state, where E is the deflection.
Sure, but feel free to continue posting here so others can tune in. I will see it.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Programmatic Tuning에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!