PID controller behaves strangely for larger Ts values

7 次查看(过去 30 天)
I am designing a PID controller for a rudimentary elevator system
The elevator has to take more than 5s to arrive at the next floor but no more than 6s
The transfer function is as follows:
syms Ki Kd Kp s
M = 1019;
B = 100;
K = 19875;
num=[1];
den=[M B K];
G = tf(num, den)
G = 1 ------------------------ 1019 s^2 + 100 s + 19875 Continuous-time transfer function.
Zeta = 1;
Ts = 5;
Wn = 0.8;
Using the PID function
GC = (Kp*s + Ki + Kd*s^2)/s
The close loop function is found to be:
T = (Kp*s + Ki + Kd*s^2)/(M*s^3 + B*s^2 + K*s + Kp*s + Ki + Kd*s^2)
Comparing this with the ITAE ideal tranfer function for a third order system yields the following equations
ITAE_tf3 = vpa(Wn^3/(s^3 + (Wn)*s^2 + (Wn^2)*s + Wn^3))
Kp = (2.15)*(M)*(Wn^2)-(K)
Kp = -1.8473e+04
Ki = M*(Wn^3)
Ki = 521.7280
Kd = (1.75)*(M)*(Wn)-B
Kd = 1.3266e+03
However the large Kp value drives the system downwards when it should be going up and the large integrator value also causes some issues
Changing zeta and ts gives me a results that is almost what I need
overshoot = 10/100;
Zeta = (-log(overshoot))/sqrt(pi^2+(log(overshoot)^2));
% Zeta = 1
Ts = 2.4;;
Wn = 4/(Zeta*Ts);
But of course the Ts value is too high.
Any help would be greatly appreciated

回答(1 个)

Sam Chak
Sam Chak 2024-10-17
编辑:Sam Chak 2024-10-17
There are a few things for which you can find detailed explanations in control theory books. In short, the ideal ITAE third-order transfer function is different from your actual PID-controlled third-order transfer function.
Blunder: Two coefficients are missing in your version of the ITAE third-order transfer function.
While your derived PID-controlled third-order transfer function is correct, to make an apples-to-apples comparison, we must divide both the numerator and the denominator by M.
%% Plant TF
M = 1019;
B = 100;
K = 19875;
num = [1];
den = [M B K];
Gp = tf(num, den)
Gp = 1 ------------------------ 1019 s^2 + 100 s + 19875 Continuous-time transfer function.
%% Ideal TF
wn = 3; % Tune this parameter only, DO NOT individually tune P-I-D gains (Always use single parameter tuning!)
Gi = tf(wn^3, [1, 1.781*wn, 2.171*wn^2, wn^3])
Gi = 27 ------------------------------ s^3 + 5.343 s^2 + 19.54 s + 27 Continuous-time transfer function.
figure(1)
step(Gi, 5), grid on
title('Step response of Ideal TF')
%% Pole placement
ki = M*wn^3;
kp = 2.171*M*wn^2 - K;
kd = 1.781*M*wn - B;
Gc = pid(kp, ki, kd)
Gc = 1 Kp + Ki * --- + Kd * s s with Kp = 35.2, Ki = 2.75e+04, Kd = 5.34e+03 Continuous-time PID controller in parallel form.
%% Closed-loop TF
Gcl = minreal(feedback(Gc*Gp, 1))
Gcl = 5.245 s^2 + 0.03458 s + 27 ------------------------------ s^3 + 5.343 s^2 + 19.54 s + 27 Continuous-time transfer function.
zero(Gcl) % to be cancelled out later
ans =
-0.0033 + 2.2689i -0.0033 - 2.2689i
figure(2)
step(Gcl, 5), grid on
title('Step response of Closed-loop TF')
%% Design of Prefilter, Gf
[num, den] = tfdata(Gcl, 'v');
Gf = tf(den(end), num)
Gf = 27 -------------------------- 5.245 s^2 + 0.03458 s + 27 Continuous-time transfer function.
%% Filtered Closed-loop TF
Fcl = minreal(series(Gf, Gcl))
Fcl = 27 ------------------------------ s^3 + 5.343 s^2 + 19.54 s + 27 Continuous-time transfer function.
figure(3)
step(Fcl, 5), grid on
title('Step response of Filtered Closed-loop TF')
My preferred control architecture: Simple yet accurate!
%% My PID controller
Ts = 5.5; % Desired Settling Time (single tuning parameter)
[Gc, Gh] = chakpid(Gp, Ts) % Gc in forward path, Gh in feedback path
Gc = 1 Kp + Ki * --- + Kd * s s with Kp = 1.03e+03, Ki = 367, Kd = 725 Continuous-time PID controller in parallel form. Gh = 2.862 s^2 - 25.29 s + 0.5059 ---------------------------- s^2 + 1.423 s + 0.5059 Continuous-time transfer function.
%% Closed-loop System
Gcl = minreal(feedback(Gc*Gp, Gh))
Gcl = 0.7113 s^4 + 2.024 s^3 + 2.159 s^2 + 1.024 s + 0.1821 --------------------------------------------------------- s^5 + 3.556 s^4 + 5.059 s^3 + 3.598 s^2 + 1.28 s + 0.1821 Continuous-time transfer function.
S = stepinfo(Gcl) % Performances
S = struct with fields:
RiseTime: 3.0891 TransientTime: 5.5000 SettlingTime: 5.5000 SettlingMin: 0.9002 SettlingMax: 0.9995 Overshoot: 0 Undershoot: 0 Peak: 0.9995 PeakTime: 10.7900
figure(4)
step(Gcl, round(3*Ts, 0)), grid on, grid minor
%% Double compensation control scheme
function [C, H] = chakpid(P, Ts)
% Gp is a 2nd-order Plant
% Ts is the desired settling time
[numP, denP] = tfdata(minreal(P), 'v');
a1 = denP(2);
a2 = denP(3);
b = numP(3);
Tc = -log(0.02)/Ts; % Desired time constant
%% The formulas
k1 = (3*(b^2)*((Tc/b)^2) - a2)/b;
k2 = (b^2)*((Tc/b)^3);
k3 = (3*b*(Tc/b) - a1)/b;
k4 = 2*b*((Tc/b)^2); % P-gain of PID controller
k5 = k2; % I-gain of PID controller
k6 = Tc/b; % D-gain of PID controller
C = pid(k4, k5, k6); % Classical PID controller
H = minreal(tf([k3 k1 k2], [k6 k4 k5])); % Compensator at the Sensor path
end

类别

Help CenterFile Exchange 中查找有关 PID Controller Tuning 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by