First order PID controller
72 次查看(过去 30 天)
显示 更早的评论
Hi,
I am having a bit of bother with a PID controller I am creating on MATLAB. I have the below transfer function for my system, which i've to incorporate a PID controller into.
clc
clear all
% Implementing T.F G(s) = 85/(42s+1)
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs = tf([num],[den],'InputDelay',10) %a transfer function with a lag tim); %transfer function
u = 1; %unit step input
% plotting the graph
figure(1)
[x,y]=step(u*Gs);
plot(y,x);
xlabel('time /s'); ylabel('Level');
I have tried using the below code for the PID controller, which doesn't seem to have the same times. Also on all controllers i've done the step response never got to 1 without tuning before.
% Implementing T.F G(s) = 85/(42s+1)
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs= tf(num,den); %TF function
H=[1]; %feedback
M=feedback(Gs,H);
step(M)
grid on
When I add the PID controller script I no longer get anything I expect. I set Kp to 2, which does quicken the response, however I expect some overshoot. I have increased Kp bu different higher values and it only provides quicker respnses without overshoot. This is not how any of my other controllers have operated.
%%
Kp = 2;
Ki = 0;
Kd = 0;
Gc=pid(Kp,Ki,Kd)
Mc=feedback(Gc*Gs,H)
step(Mc)
grid on
I know I am doing something wrong, but can't see what. Is there anyone that can look this over and assist? I am using Matlab online as I do not have permission to download additional content on my laptop as IT won't allow it. You may have also noticed that there is no delay added to the scripts. This is due to it not working if I do.
0 个评论
回答(3 个)
Steven Caliari
2021-4-6
Hi,
your system is a first-order system. If you want see an overshoot use a second-order system.
First order system doesn't have overshoot.
Try with: den = [10 42 1];
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [10 42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs= tf(num,den); %TF function
H=[1]; %feedback
M=feedback(Gs,H);
step(M)
grid on
3 个评论
Steven Caliari
2021-4-6
Hi John,
the oscillation appear into the system when the poles are immaginary.
If you change only Kp and Ki=Kd=0, you are moving the pole on real axis, so the oscilltion can never appear.
Plot with Kp = 2, Kd=Ki=0
When you change Ki (example with Ki = 3):
Now the system has damped oscillation.
System evolution:
Sam Chak
2022-8-20
Hi @John Rogers
Just some additional info. The plant is a 1st-order Type-0 system.
num = [85];
den = [42 1];
Gp = minreal(tf(num, den))
Adding an Integral action raises the system to become a Type-1 system.
Kp = 43239/42500;
Ki = 2059/85000;
Gc = pid(Kp, Ki)
The step response will achieve at steady-state.
Gcl = minreal(feedback(Gc*Gp, 1))
step(Gcl), grid on
Sc = stepinfo(Gcl)
0 个评论
venkatesan T
2024-8-8
MATLAB code required for the given problem.
Consider a unity feedback system with open loop transfer function, G(s)=100/(s+1)(s+2)(s+3). Determine a PID controller, so that the phase margin of the system is 45 degree at a frequency of 4 rad/sec and the steady state error for unit ramp input is 0.1
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gain Scheduling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!