PI controller does not have the effect I would expect from the calculations
7 次查看(过去 30 天)
显示 更早的评论
I am designing a PI controller for the following plant
K = 11041666;
B = 100;
M = 1019;
num = [K];
den = [M B K];
sys = tf(num,den);
I need to design for 10% overshoot and a settling time of 5 seconds
The closed loop transfer function is as follows:
syms k m b s kp ki
G = k/(m*s^2+b*s+k);
Gc = (kp*s+ki)/s;
T = (kp*s*k+ki*k)/(m*s^3+b*s^2+k*s*(1+kp)+ki*k)
These are the calculations for Kp and Ki
overshoot = 10/100;
Zeta = (-log(overshoot))/sqrt(pi^2+(log(overshoot)^2));
Wn = 5/(4*Zeta);
Ki = (Wn^3*M)/K;
Kp = ((2.15*Wn^2*M)/K)-1;
However with these values this is the response I get
The block diagram
The controller internals
The step input
Yellow if the target and blue is the system response
I am making a mistake somewhere but I have been unable to find it. Any assistance would be greatly appreciated
2 个评论
Aquatris
2024-10-16
Any reason why you are not using a PID? Your system is lightly damped. I doubt you can achieve both stability and performance with a PI controller. You would need a damping term in your controller.
K = 11041666;
B = 100;
M = 1019;
num = [K];
den = [M B K];
sys = tf(num,den);
damp(sys)
The formulas for the overshoot etc are valid if the system is stable already. They do not tell if a system is stable or not. Also I am not sure about the formulas you use to get Kp and Ki from Wn,M and K values.
采纳的回答
Sam Chak
2024-10-16
Hi @Wynand
Please see my explanations below.
%% Plant
K = 11041666;
B = 100;
M = 1019;
num = [K];
den = [M B K];
Plant = tf(num, den)
Step Response of the Uncontrolled Plant:
The response is highly oscillatory, and the settling time takes roughly 100 seconds (which is way too long). No real elevator behaves in this manner. This suggests that the modeling is incorrect, an issue that should be addressed by the person who posted the unverified solution in the original thread or by posing a new question to modeling experts.
figure(1)
step(Plant), grid on, grid minor
Controller Design:
The damping ratio has been calculated correctly; however, the natural frequency of the desired closed-loop system has not been. It seems that you may have attempted to use an approximation formula but forgot to verify its correct application. The precise value (not an approximation) of ω is 1.18516590360739 rad/s. Additionally, a 1st-order PI controller is insufficient to provide adequate compensation for a generic 2nd-order plant. Therefore, a 2nd-order PID controller should be employed.
%% Kontroler (Polish)
overshoot = 10/100;
Zeta = (-log(overshoot))/sqrt(pi^2+(log(overshoot)^2))
Wn = 3.9/(5*Zeta)
Wn = 5/(4*Zeta) % super precise value is 1.18516590360739 rad/s
Ki = (Wn^3*M)/K
Kp = ((2.15*Wn^2*M)/K)-1
Kontroler = pid(Kp, Ki)
Analysis of the Closed-Loop System:
After designing the controller, the closed-loop poles should be checked to ensure that all real parts are negative. Clearly, at least one pole has a positive real part, as indicated by the response, which explodes, as shown in the figure below.
%% Closed-loop system
ClosedLoop = minreal(feedback(Kontroler*Plant, 1))
pole(ClosedLoop) % check for positive real part
figure(2)
step(ClosedLoop), grid on, grid minor
Suggested Control Solution:
If you wish to continue pursuing a control solution for this questionable elevator model, consider using the following PID control configuration. No overshoot is always preferable for the passengers' experience.
%% PID controller
Ts = 5; % Desired Settling Time
[Gc, Gh] = chakpid(Plant, Ts) % Gc in forward path, Gh in feedback path
%% Closed-loop System
Gcl = minreal(feedback(Gc*Plant, Gh))
S = stepinfo(Gcl) % Performances
figure(3)
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
4 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!