How can I tune PID controller using GENETIC ALGORITHM.......????

16 ビュー (過去 30 日間)
RAJEEV KUMAR
RAJEEV KUMAR 2012 年 11 月 15 日
コメント済み: Fer Ruiz 2019 年 1 月 22 日
num=6;
den=[48 44 12 1];
gp=tf(num,den); % PLANT TRANSFER FUNCTION
%%OVERALL TRANSFER FUNCTION
gpgcr=gp*gcr;
sysy4=feedback(gpgcr,1);
%%BY GENETIC ALGORITHM
N=5; % NO OF POPULATION
M=4;
iter=12; % no.of iterations
maxiter=1;
%%initialization of pbest and gbest
for i=1:N
for j=1:iter
for k=1:M
pbest(i,j,k)=rand;
gbest(i,j,k)=rand;
end
end
end
%%initialization of kp,kd,ki and calculation of ISE
for i=1:N
for j=1:iter
for k=1:M
kp(i,j,k)=rand;
kd(i,j,k)=rand;
ki(i,j,k)=rand;
%%controller transfer function
numgc=[kd(i,j,k),kp(i,j,k),ki(i,j,k)];
dengc=[1,0];
gc=tf(numgc,dengc); % controller T.F
g=gp*gc;
GCL=feedback(g,1); % gives c(s)/r(s)
[num,den] = tfdata(GCL,'v'); % 'V' return the numerator and denominator directly as
......row vectors rather than as cell arrays
GCL1=1-GCL; % GIVES e(s)/r(s)
[nume,dene]=tfdata(GCL1,'v');
dene1=[dene,0]; % for e(s)
[r,p,k1]=residue(nume,dene1);
n=length(p);
for y=1:n
h(y)=ilaplace(r(y)/(s-p(y)));
end
h;
q=0;
for z=1:n
q=h(1,z)+q; % gives e(t)
end
q;
q=vpa(q,5); % Variable-precision arithmetic
qsq=q^2;
lqsq=laplace(qsq); % to get laplace transform
isee=limit(lqsq,s,0);
ise=vpa(isee,5);
x(i,j,k)=ise %CAN WE TAKE IT AS FITTNESS FUNCTION..??
end
end
end
  3 件のコメント
vishvas  kumar
vishvas kumar 2016 年 6 月 5 日
what is 'gcr' please explore it.
govindan
govindan 2016 年 12 月 30 日
gcr is controller transfer function.

サインインしてコメントする。

回答 (3 件)

Charitha Yampati
Charitha Yampati 2016 年 12 月 10 日
what is gcr here

Nasser Almabrok
Nasser Almabrok 2018 年 4 月 5 日
there are many mistakes in this code, so you have to fix it and remove some commands that you do not need.

alnaser alnaser
alnaser alnaser 2018 年 11 月 1 日
Error using InputOutputModel/feedback (line 138) The first and second arguments of the "feedback" command must have compatible I/O sizes.
Error in gapid (line 6) sysy4=feedback(gpgcr,1);
  1 件のコメント
Fer Ruiz
Fer Ruiz 2019 年 1 月 22 日
I have the same error, could you solve it?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePID Controller Tuning についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by