Matlab PI control first order system

196 Ansichten (letzte 30 Tage)
MikeSv
MikeSv am 13 Nov. 2017
Kommentiert: Robert U am 14 Aug. 2019
Hi everyone. Iam quite new to Control theory and I have a question regarding PI Control using Matlab.
I have a first order transfer function :
G(s) = 5/(s+1)
and I try to use Matlab to form a feedback loop using a PI controller with the following code:
s = tf('s');
Kp = 1;
Ki = 1;
C = Kp + Ki/s
G = tf([5],[1 1])
figure(1)
step(G)
H = feedback(C*G,1)
figure(2)
step(H)
When I plot the step response of G, it goes from zero to five like expected, but when I plot the feedback response it only goes from zero to 1. Changing Kp and Ki does not have any effect.
Any help would be great!
Thanks in advance,
/M
  1 Kommentar
Divyani Rathod
Divyani Rathod am 1 Feb. 2019
How can i calculate Kp ki value for Peak overshoot <=11%, settling time<=5s. Transfer function is 3.24/15.24s+1 (My calculated value is, kp = 7.2152 and ki = 9.1061, zeta = 0.5749, w_n = 1.3916); (using state space and without state space) and also How can i calculate Fractional kp and ki.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Robert U
Robert U am 13 Nov. 2017
Bearbeitet: Robert U am 13 Nov. 2017
Hello MikeSv:
The system response is correct from my point of view. The desired response value of step-function is "1". The uncontrolled system G is responding with a gain of "5". The controlled system instead is responding with "1" as desired.
Edit:
The change of Kp and Ki have - of course - an effect. Due to automatic scaling it might be you did not mention.
Kind regards,
Robert
  2 Kommentare
bryce howard
bryce howard am 24 Jul. 2019
Hey Robert, how did you get Ki and Kp to display like that?
Robert U
Robert U am 14 Aug. 2019
% define transfer functions
s = tf('s');
C =@(Kp,Ki) Kp + Ki/s;
G = tf([5],[1 1]);
% define parameter combinations
Kp = [1,2,4,1,1];
Ki = [1,1,1,2,4];
% create figure
figure
ah = axes;
hold(ah,'on');
% loop through given combinations of Kp and Ki
for ik = 1:length(Kp)
H = feedback(C(Kp(ik),Ki(ik))*G,1);
step(H)
end
% create cell array of legend entries
cLegend = arrayfun(@(Kp,Ki) sprintf('Kp = %i, Ki = %i',Kp,Ki),Kp,Ki,'UniformOutput',false);
% add legend to figure
legend(ah,cLegend)

Melden Sie sich an, um zu kommentieren.


MikeSv
MikeSv am 13 Nov. 2017
Hi and thank you so much for the replies!
What I don't understand is, when I have my open loop system, and I want the output to be 5 when the input is 1 (a unit step). What happens to my DC Gain in the closed loop? I expected my output to be 5 as well in the closed loop, just with in example a faster rise time when changing the value of the P controller.
Thanks again,
M

partha das
partha das am 5 Feb. 2019
Bearbeitet: partha das am 5 Feb. 2019
OLTF is 5/(s+1). In this case DC gain is 5 (obtained by setting s=0 in the OLTF).
Your CLTF is 5/(s+1) when you use Kp=1 and Ki=1. So in this case DC gain is 1. As a result when you apply an unit step input to this CLTF, your steady state output will be 1 i.e. the steady state error (reference step input of magnitude 1 - steady output of 1) is 0. In fact for any values of Kp and Ki, you will get a steady state error of 0 because the PI controller always tracks the reference input perfectly.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by