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
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)
Pole Damping Frequency Time Constant (rad/seconds) (seconds) -4.91e-02 + 1.04e+02i 4.71e-04 1.04e+02 2.04e+01 -4.91e-02 - 1.04e+02i 4.71e-04 1.04e+02 2.04e+01
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.
Wynand
Wynand 2024-10-16
I was recommened to use the PI controller but have no real reason to. I will redo the calculations for a PID controller

请先登录,再进行评论。

采纳的回答

Sam Chak
Sam Chak 2024-10-16
Please see my explanations below.
%% Plant
K = 11041666;
B = 100;
M = 1019;
num = [K];
den = [M B K];
Plant = tf(num, den)
Plant = 1.104e07 --------------------------- 1019 s^2 + 100 s + 1.104e07 Continuous-time transfer function.
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))
Zeta = 0.5912
Wn = 3.9/(5*Zeta)
Wn = 1.3195
Wn = 5/(4*Zeta) % super precise value is 1.18516590360739 rad/s
Wn = 2.1145
Ki = (Wn^3*M)/K
Ki = 8.7250e-04
Kp = ((2.15*Wn^2*M)/K)-1
Kp = -0.9991
Kontroler = pid(Kp, Ki)
Kontroler = 1 Kp + Ki * --- s with Kp = -0.999, Ki = 0.000873 Continuous-time PI controller in parallel form.
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))
ClosedLoop = -1.083e04 s + 9.454 ----------------------------------- s^3 + 0.09814 s^2 + 9.613 s + 9.454 Continuous-time transfer function.
pole(ClosedLoop) % check for positive real part
ans =
0.4074 + 3.1923i 0.4074 - 3.1923i -0.9129 + 0.0000i
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
Gc = 1 Kp + Ki * --- + Kd * s s with Kp = 0.000113, Ki = 4.42e-05, Kd = 7.22e-05 Continuous-time PID controller in parallel form. Gh = 2.875 s^2 - 1.385e04 s + 0.6122 ------------------------------- s^2 + 1.565 s + 0.6122 Continuous-time transfer function.
%% Closed-loop System
Gcl = minreal(feedback(Gc*Plant, Gh))
Gcl = 0.7824 s^4 + 2.449 s^3 + 2.874 s^2 + 1.499 s + 0.2932 --------------------------------------------------------- s^5 + 3.912 s^4 + 6.122 s^3 + 4.79 s^2 + 1.874 s + 0.2932 Continuous-time transfer function.
S = stepinfo(Gcl) % Performances
S = struct with fields:
RiseTime: 2.8083 TransientTime: 5.0000 SettlingTime: 5.0000 SettlingMin: 0.9005 SettlingMax: 0.9986 Overshoot: 0 Undershoot: 0 Peak: 0.9986 PeakTime: 8.3900
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 个评论
Wynand
Wynand 2024-10-16
Thank you for the response. The transfer function has a K as the numerator but I have been instructed to use a 1 as the numerator. In which case the step response is an attenuating oscillation around -1
Wynand
Wynand 2024-10-17
编辑:Wynand 2024-10-17
Good morning @Sam Chak
Thank you for your insights.
I have re-evaluated over and over but I am missing a few steps it seems
syms m b k kp ki kd s
G = k/(m*s^2+b*s+k)
Gc = (kp*s + ki*s^2 + kd)/s
T = (k*(kp*s + ki*s^2 + kd))/((m*s^3+b*s^2+k*s+kp*s + ki*s^2 + kd))
From this and the Ideal ITAE 3rd order transfer function I get the following expressions for Kp, Ki and Kd
Zeta = 1;
Ts = 5;
Wn = 4/(Zeta*Ts);
M = 1019;
B = 100;
K = 12421875;
Kp = (2.15)*(Wn^2)*(M/K)-1
Kp = -0.9999
Ki = (Wn^3)*(M/K)
Ki = 4.2001e-05
Kd = ((1.75)*(M)*(Wn)-B)*(1/K)
Kd = 1.0680e-04
Am I making a mistake somewhere or did I misinterpret your previous answers?

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by