Professional Documents
Culture Documents
2016114104 박영훈
문제 5
다음 공정들이 PID제어기에 의해 제어될 때 단위계단 설정치 변화(unit setpoint change)에 대해 정상상태에서 PID의
I part값이 얼마가 되겠는가? 모사를 사용하지 말고 이론적으로 구하시오. 이때 유도과정을 적어야 합니다.
exp
문제 6) 의 공정모델에 대해 답하시오.
6-1) IMC 튜닝룰을 이용하여 PID제어기의 파라미터를 구하시오. 이때, 모델링에러가 5%있다고 가정하시오.
6-2) 단위계단 설정치 변화에 대해 Closed-loop Response를 시뮬레이션 하시오. 이때, 0.02를 sampling time으로
사용하시오.
6-1)
r=1.7*th;
pi_kcs=(2*t+th)/2/r/k; pi_tis=t+th/2;
r=0.25*th;
pid_kcs=(2*t+th)/2/(r+th)/k; pid_tis=t+th/2;
pid_tds=t*th/(2*t+th);
1.2 12
y s(t)
y(t) 10
1
0.8
6
0.6 4
2
0.4
0.2
-2
0 -4
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
문제 7
exp
공정
7-1) 위 공정에 대해 ITAE-1 튜닝방법을 사용하여 PID 제어기의 파라미터를 구하고 단위 계단 설정치 변화에 대해
시뮬레이션 하시오. 이때, 0.01을 sampling time으로 사용하시오. Mode reduction 방법을 적용할 때, zero를 보수적
으로 처리하사오.
핵심 : (-s+10) -> 10*(-0.1s+1)로 바꿔서 양수 zero이면 exp(-0.1s)를 추가 아니면 1로 근사.
7-2) 7-1)에서 설계된 PID제어 시스템에 대한 안정도를 판별하시오.
7-3) 7-1)에서 설계된 PID제어 시스템에 대한 gain margin과 phase margin을 구하시오.
7-4) 위 공정에 대해 ITAE-2튜닝방법을 사용하여 PID제어기의 파라미터를 구하고 단위 계단 설정치 변화(unit step
setpoint change)에 대해 시뮬레이션 하시오. 이때, 0.01을 sampling time으로 사용하시오.
7-1)
function [G]=f_hwan_5_2(w)
s=i*w;
G=10.0*exp(-0.3*s)/(s+1)^3; % (mod)
end
function [next_x y]=g_pid_itae1_ex1_shin(x,delt,u)
subdelt=delt/5; n=round(delt/subdelt);
A=[0 0 -1; 1 0 -3; 0 1 -3]; B=[10; -1; 0]; C=[0 0 1]; delay=0.2;
delay_k=round(delay/delt);
for i=1:n
dx=A*x+B*u(500-delay_k);
x=x+dx*subdelt;
end
next_x=x; y=C*x;
end
% related
clear;
w=0.0; delta_w=0.05;
while(1) % search boundary in which wu exists
w=w+delta_w; g=f_hwan_5_2(w);
if(imag(g)>0.0) break; end
end
w1=w-delta_w; w2=w; % w 1< wu < w2
while(1) % find wu using the bisection method
w=(w1+w2)/2; g1=f_hwan_5_2(w1); g=f_hwan_5_2(w);
if(imag(g)*imag(g1)>0.0) w1=w; else w2=w; end
if(abs(imag(g))<0.00001) break; end
end
w;
k=abs(f_hwan_5_2(0));
tau=sqrt(k^2-abs(g)^2)/abs(g)/w;
theta=(-atan2(imag(g),real(g))+atan(-tau*w))/w;
fprintf('k=%5.3f tau=%5.3f theta=%5.3f \n',k,tau,theta);
%error
k=k*(1+0.00);
t=tau*(1+0.00);
th=theta*(1+0.00)*(1+0.00);
%PID_ITAE1
pi_kcs=0.586*(th/t)^(-0.916)/k; pi_tis=t/(1.030-0.165*th/t);
pid_kcs=0.965*(th/t)^(-0.850)/k; pid_tis=t/(0.796-0.1465*th/t);
pid_tds=t*0.308*(th/t)^0.929;
pi_kcd=0.859*(th/t)^(-0.977)/k; pi_tid=t/(0.674*(th/t)^(-0.680));
pid_kcd=1.357*(th/t)^(-0.947)/k; pid_tid=t/(0.842*(th/t)^(-0.738));
pid_tdd=t*0.381*(th/t)^0.995;
fprintf('PID_ITAE1(setpoint) : kcds=%6.3f, tis=%6.3f, tds=%6.3f
\n',pid_kcs,pid_tis,pid_tds);
fprintf('PID_ITAE1(disturbance) : kcdd=%6.3f, tid=%6.3f, tdd=%6.3f
\n',pid_kcd,pid_tid,pid_tdd);
kc=pid_kcs; ti=pid_tis; td=pid_tds; % setpoint change simulation
% kc=pid_kcd; ti=pid_tid; td=pid_tdd; % disturbance rection simulation
t=0.0; t_final=10.0; x=[0 0 0]'; y=0.0; yb=0.0; ys=0.0; ysb=0.0; dis=0.0;
delta_t=0.01; n=round(t_final/delta_t); h_u=zeros(1,500); s=0.0;
for i=1:n
t_array(i)=t; y_array(i)=y; ys_array(i)=ys;
if(t>1) ys=1.0; else ys=0.0; end % setpoint change simulation
% if(t>1) dis=1.0; else dis=0.0; end % disturbance rection simulation
s=s+(kc/ti)*(ys-y)*delta_t;
u=kc*(ys-y)+s+kc*td*((ys-y)-(ysb-yb))/delta_t;
ysb=ys; yb=y; % one sampling before
u_array(i)=u;
for j=1:499 h_u(j)=h_u(j+1); end
h_u(500)=u+dis; [x y]=g_pid_itae1_ex1_shin(x,delta_t,h_u);
t=t+delta_t;
end
figure(1); hold on; plot(t_array,ys_array,t_array,y_array); legend('y_{s}(t)','y(t)');
figure(2); plot(t_array,u_array);
>> hwan_error_5_2
k=10.000 tau=3.317 theta=1.378
PID_ITAE1(setpoint) : kcds= 0.204, tis= 4.512, tds= 0.452
PID_ITAE1(disturbance) : kcdd= 0.312, tid= 2.060, tdd= 0.527
>> pid_itae1_ex1_shin
1.2
y s(t)
y(t) 3
1
2.5
0.8
2
0.6
1.5
0.4
1
0.2
0.5
0
0
-0.2
0 1 2 3 4 5 6 7 8 9 10 0 0.5 1 1.5 2 2.5 3
7-2)
w=0;
delta_w=0.0001;
while(1)
w=w+delta_w;
r=f_hwan_6_3_b(w);
f=abs(r);
if(abs(1-f)<0.0001) break; end
end
wg=w;
r=f_hwan_6_3_b(wu);
GOL=abs(r);
gi=imag(f_hwan_6_3_b(wg));
gr=real(f_hwan_6_3_b(wg));
PM=atan2(gi,gr)+pi;
GM=1/abs(r);
fprintf('wg= %5.3f PM= %5.3f \n',wg,PM);
fprintf('wu= %5.3f GM= %5.3f \n',wu,GM);
th=atan2(gi,gr);
if (GOL < 1)
fprintf('stable\n');
fprintf('reasons : |Gol(Wc)| < 1\n');
elseif (GOL == 1)
fprintf('oscillation\n');
fprintf('reasons : |Gol(Wc)| = 1\n');
else
fprintf('unstable\n');
fprintf('reasons : |Gol(Wc)| > 1\n');
end
>> hwan_6_3_b
wg= 0.782 PM= 0.985
wu= 1.825 GM= 3.564
stable
reasons : |Gol(Wc)| < 1
7-3)
function [G]=rr(w)
s=i*w;
Gp=(-s+10)*exp(-0.2*s)/(s+1)^3;
Gc=0.2036+0.2036/(4.5117*s)+0.2036*0.4518*s;
G=Gp*Gc;
end
clear;
w=0.0; delta_w=0.00001;
while(1) % search boundary in which wu exists
w=w+delta_w; g=rr(w);
t=abs(g);
if(abs(1-t)<0.00001) break; end
end
wg=w;
gi=imag(rr(wg));
gr=real(rr(wg));
PM=atan2(gi,gr)+pi;
clear;
w=0.0; delta_w=0.05;
while(1) % search boundary in which wu exists
w=w+delta_w; g=rr(w);
if(imag(g)>0.0) break; end
end
w1=w-delta_w; w2=w; % w 1< wu < w2
while(1) % find wu using the bisection method
w=(w1+w2)/2; g1=rr(w1); g=rr(w);
if(imag(g)*imag(g1)>0.0) w1=w; else w2=w; end
if(abs(imag(g))<0.000001) break; end
end
wu=w; % ultimate frequency wu is found
k=rr(wu);
GM=1/abs(k);
fprintf('wu= %5.3f GM= %5.3f \n',wu,GM);
>> gm1
wu= 1.825 GM= 3.564
>> pm1
wg= 0.782 PM= 0.985
7-4)
function [G]=g_mr_ex5(w)
s=i*w;
G=(-s+10)*exp(-0.2*s)/(s+1)^3;
end
function [next_x y] = g_pid_itae2_ex5(x,delt,u)
subdelt = delt/5; n = round(delt/subdelt);
A = [0 0 -1; 1 0 -3; 0 1 -3];
B = [10 -1 0]'; C = [0 0 1]; delay = 0.2;
delay_k = round(delay/delt);
for i = 1:n
dx = A*x+B*u(500-delay_k);
x = x+dx*subdelt;
end
next_x = x; y = C*x;
end
clear;
w=0.0; delta_w=0.05;
while(1) % search boundary in which wu exists
w=w+delta_w; g=g_mr_ex5(w);
if(imag(g)>0.0) break; end
end
w1=w-delta_w; w2=w; % w 1< wu < w2
while(1) % find wu using the bisection method
w=(w1+w2)/2; g1=g_mr_ex5(w1); g=g_mr_ex5(w);
if(imag(g)*imag(g1)>0.0) w1=w; else w2=w; end
if(abs(imag(g))<0.000001) break; end
end
wu=w; % ultimate frequency wu is found
k=abs(g_mr_ex5(0));
for j=1:10 % least square method
w=(j-1)*wu/9.0; G(j)=g_mr_ex5(w);
y(j,1)=k^2-(abs(G(j))^2);
phi_1(j,1)=(abs(G(j))^2)*w^4;
phi_2(j,1)=(abs(G(j))^2)*w^2;
end % P_hat: solution of the least square method
PHI=[phi_1 phi_2]; Y=y; P_hat=inv(PHI'*PHI)*PHI'*Y;
tau=P_hat(1)^(1.0/4.0);
xi=((P_hat(2)+2*tau^2)/(4*tau^2))^0.5;
theta=(pi+atan2(-2*xi*tau*wu,1-wu^2*tau^2))/wu;
% tau: time contant, xi: damping factor, theta: time delay
fprintf('k=%5.3f tau=%5.3f \n',k,tau);
fprintf('xi=%5.3f theta=%5.3f \n',xi,theta);
if((th/t)<=1.0)
tis=(2.055+0.072*th/t)*d*t;
else
tis=(1.768+0.329*th/t)*d*t;
end
tds=t/(1.0-exp(-(th/t)^(1.060)*d/0.870))/(0.55+1.683*(th/t)^(-1.090));
if((th/t)<0.9)
kcd=(-0.670+0.297*(th/t)^(-2.001)+2.189*(th/t)^(-0.766)*d)/k;
else
kcd=(-0.365+0.260*(th/t-1.400)^2+2.189*(th/t)^(-0.766)*d)/k;
end
if((th/t)<0.4)
tid=(2.212*(th/t)^(0.520)-0.300)*t;
else
tid=(-0.975+0.910*(th/t-1.845)^2+(1-exp(-d/(0.150+0.330*th/t)))*(5.250-0.880*(th/t-2.80
0)^2))*t;
end
tdd=t/(-1.900+1.576*(th/t)^(-0.530)+(1-exp(-d/(-0.15+0.939*(th/t)^(-1.121))))*(1.45+0.9
69*(th/t)^(-1.171)));
1.2 20
y s(t)
y(t)
18
1
16
0.8 14
12
0.6
10
0.4
8
0.2 6
4
0
2
-0.2 0
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
function [G]=g_mr_ex6(w)
s=i*w;
G=(2*exp(-0.8*s)/((2*s+1)*(s+1)^2))/(1+2*exp(-0.2*s)/(2*s+1));
end
function [next_x,y]=g_pid_itae2_ex6_p(x,delt,u);
subdelt=delt/5; n=round(delt/subdelt);
A=[0 -1; 1 -2]; B=[1; 0]; C=[0 1]; delay=0.6;
delay_k=round(delay/delt+0.00001);
for i=1:n
dx=A*x+B*u(500-delay_k);
x=x+dx*subdelt;
end
next_x=x; y=C*x;
return
function [next_x,y]=g_pid_itae2_ex6_s(x,delt,u);
subdelt=delt/5; n=round(delt/subdelt);
A=[-0.5]; B=[1]; C=[1]; delay=0.2;
delay_k=round(delay/delt+0.00001);
for i=1:n
dx=A*x+B*u(500-delay_k);
x=x+dx*subdelt;
end
next_x=x; y=C*x;
return
clear;
w=0.0; delta_w=0.05;
while(1) % search boundary in which wu exists
w=w+delta_w; g=g_mr_ex6(w);
if(imag(g)>0.0) break; end
end
w1=w-delta_w; w2=w; % w 1< wu < w2
while(1) % find wu using the bisection method
w=(w1+w2)/2; g1=g_mr_ex6(w1); g=g_mr_ex6(w);
if(imag(g)*imag(g1)>0.0) w1=w; else w2=w; end
if(abs(imag(g))<0.000001) break; end
end
wu=w; % ultimate frequency wu is found
k=abs(g_mr_ex6(0));
for j=1:10 % least square method
w=(j-1)*wu/9.0; G(j)=g_mr_ex6(w);
y(j,1)=k^2-(abs(G(j))^2);
phi_1(j,1)=(abs(G(j))^2)*w^4;
phi_2(j,1)=(abs(G(j))^2)*w^2;
end % P_hat: solution of the least square method
PHI=[phi_1 phi_2]; Y=y; P_hat=inv(PHI'*PHI)*PHI'*Y;
tau=P_hat(1)^(1.0/4.0); xi=((P_hat(2)+2*tau^2)/(4*tau^2))^0.5;
theta=(pi+atan2(-2*xi*tau*wu,1-wu^2*tau^2))/wu;
% tau: time contant, xi: damping factor, theta: time delay
fprintf('k=%5.3f tau=%5.3f \n',k,tau);
fprintf('xi=%5.3f theta=%5.3f \n',xi,theta);
k=k; t=tau; d=xi; th=theta;
% static gain, time constant, dampling factor, time delay
if(d<=0.9)
kcs=(-0.04+(0.333+0.949*(th/t)^(-0.983))*d)/k;
else
kcs=(-0.544+0.308*th/t+1.408*(th/t)^(-0.832)*d)/k;
end
if((th/t)<=1.0)
tis=(2.055+0.072*th/t)*d*t;
else
tis=(1.768+0.329*th/t)*d*t;
end
tds=t/(1.0-exp(-(th/t)^(1.060)*d/0.870))/(0.55+1.683*(th/t)^(-1.090));
if((th/t)<0.9)
kcd=(-0.670+0.297*(th/t)^(-2.001)+2.189*(th/t)^(-0.766)*d)/k;
else
kcd=(-0.365+0.260*(th/t-1.400)^2+2.189*(th/t)^(-0.766)*d)/k;
end
if((th/t)<0.4)
tid=(2.212*(th/t)^(0.520)-0.300)*t;
else
tid=(-0.975+0.910*(th/t-1.845)^2+(1-exp(-d/(0.150+0.330*th/t)))*(5.250-0.880*(th/t-2.80
0)^2))*t;
end
tdd=t/(-1.900+1.576*(th/t)^(-0.530)+(1-exp(-d/(-0.15+0.939*(th/t)^(-1.121))))*(1.45+0.9
69*(th/t)^(-1.171)));
1.2 140
120
1
100
0.8
80
0.6
60
0.4
40
0.2
20
0 0
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20