No logro estabilizar mi sistema por PID

6 次查看(过去 30 天)
A pesar de aplicar de todo no se logra estabilizar

回答(1 个)

Sam Chak
Sam Chak 2025-7-19
编辑:Sam Chak 2025-7-19
For learning purposes, I am providing a demo below to illustrate that an ideal Proportional-Derivative (PD) controller can be designed to stabilize the unstable 3rd-order system. The effectiveness of this approach stems from the fact that only the proportional and derivative terms in the denominator carry negative signs.
First, we need to construct a target closed-loop transfer function (Tcl) around the stable accelerative term, . Subsequently, we can calculate the desired PD gains from the stable proportional and derivative terms of Tcl.
%% Unstable 3rd-order system
Gp = tf(-19.81, [1, 0.5, -392.4, -196.2])
Gp = -19.81 ------------------------------- s^3 + 0.5 s^2 - 392.4 s - 196.2 Continuous-time transfer function.
[num, den] = tfdata(Gp, 'v')
num = 1×4
0 0 0 -19.8100
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
den = 1×4
1.0000 0.5000 -392.4000 -196.2000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
%% Convert Gp to state-space model (Note that B(3) = num(4). It is an input signal amplifier gain)
sys = compreal(Gp);
sys = ss(sys.A', sys.C', sys.B', sys.D')
sys = A = x1 x2 x3 x1 0 1 0 x2 0 0 1 x3 196.2 392.4 -0.5 B = u1 x1 0 x2 0 x3 -19.81 C = x1 x2 x3 y1 1 0 0 D = u1 y1 0 Continuous-time state-space model.
%% Target Closed-loop TF (This will give us a stable critically-damped response)
wn = den(2)/3; % find natural freq using conservation of accelerative gain
Tcl = tf(wn^3, [1, 3*wn, 3*wn^2, wn^3]) % based on Hurwitz Polynomial for 3rd-order critically-damped
Tcl = 0.00463 ----------------------------------- s^3 + 0.5 s^2 + 0.08333 s + 0.00463 Continuous-time transfer function.
figure(1)
step(Tcl), grid on
%% Calculate the proportional and derivative gains
% Solve 3*wn^2 = -392.4 + den(4)*Kd for Kd
Kd = (23549/60)/num(4); % Why divide by num(4)? Because den(4) amplifies desired control input signal
% Solve wn^3 = -196.2 + den(4)*Kp for Kp
Kp = (211901/1080)/num(4);
%% Ideal PD Controller (not realizable in practice, but can be fun for learning)
Gc = pid(Kp, 0, Kd)
Gc = Kp + Kd * s with Kp = -9.9, Kd = -19.8 Continuous-time PD controller in parallel form.
%% Checking the coefficients of the numerator
Gap = series(Gc, Gp) % whether -392.4 + 392.5 = 3*wn^2 and -196.2 + 196.2 = wn^3 (not zero!)
Gap = 392.5 s + 196.2 ------------------------------- s^3 + 0.5 s^2 - 392.4 s - 196.2 Continuous-time transfer function.
%% If the above step is correct, then we can apply feedback to find the Closed-loop TF
Gcl = feedback(Gc*Gp, 1)
Gcl = 392.5 s + 196.2 ----------------------------------- s^3 + 0.5 s^2 + 0.08333 s + 0.00463 Continuous-time transfer function.
figure(2)
step(Gcl), grid on
%% Since Gcl is stable and the zero of Gcl lies on the LHS of s-plane, it can be cancelled out using a Pre-filter
[num, den] = tfdata(Gcl, 'v')
num = 1×4
0 0 392.4833 196.2046
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
den = 1×4
1.0000 0.5000 0.0833 0.0046
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
%% Pre-filter
Gf = tf(den(4), num(3:4))
Gf = 0.00463 --------------- 392.5 s + 196.2 Continuous-time transfer function.
%% Filtered Closed-loop
Fcl = minreal(series(Gf, Gcl)) % verify if Fcl == Tcl
Fcl = 0.00463 ----------------------------------- s^3 + 0.5 s^2 + 0.08333 s + 0.00463 Continuous-time transfer function.
figure(3)
step(Fcl), grid on

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by