unit step disturbance at a time of 40 seconds
27 views (last 30 days)
Show older comments
How do I generate a unit step disturbance at a time of 40 seconds for my PID controller
clear all;
s=tf('s');
load time.dat;
load response.dat;
K = 2;
Tau = 3;
dt = 0.9;
g = ((2/(3*s + 1))*(exp(-dt*s)))
[gy,tg]=step(g,20)
plot(time, response,'k',tg,gy,'r','LineWidth',2)
hold on
% Cohen - Coon PI tuning
Kc = (1/K)*(Tau/dt)*(0.9 + (dt/(12*Tau)));
Tau_1 = (dt)*((30 + 3*(dt/Tau))/(9+20*(dt/Tau)));
P = Kc;
I = Kc/Tau_1;
cont = ((s*P + I)/s);
gol = cont*g
gcl = feedback(gol,1)
step(gcl,20)
hold on
grid on
Thanks
0 Comments
Answers (1)
Sam Chak
on 12 Dec 2022
Edited: Sam Chak
on 12 Dec 2022
The closed-loop transfer function for Y(s)/D(s) is given by
The following shows how to compute the comparison between the step responses for 40 seconds. Let us know if this is the technical answer that you are looking for.
s = tf('s');
% Parameters
K = 2;
Tau = 3;
dt = 0.9;
% Plant
Gp = ((2/(3*s + 1))*(exp(-dt*s)));
% Cohen - Coon PI tuning
Kc = (1/K)*(Tau/dt)*(0.9 + (dt/(12*Tau)));
Tau_1 = (dt)*((30 + 3*(dt/Tau))/(9 + 20*(dt/Tau)));
Kp = Kc;
Ki = Kc/Tau_1;
Gc = ((Kp*s + Ki)/s);
% Response to the Unit Step Reference
Gol = Gc*Gp;
Gcl = feedback(Gol, 1); % closed-loop transfer function Y(s)/R(s)
step(Gcl, 40)
hold on
% Response to the Unit Step Disturbance
Gcd = feedback(Gp, Gc); % closed-loop transfer function Y(s)/D(s)
step(Gcd, 40)
legend('Step Reference Response', 'Step Disturbance Response')
hold off, grid on
0 Comments
See Also
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!