Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
vuoi
o PayPal
tutte le volte che vuoi
M M M M 168
Variazione dei parametri Kp, τ e θ
Anche in questo caso sono stati calcolati i margini di guadagno e di fase al variare dei parametri del
processo. Le osservazioni sulla stabilità del sistema sono analoghe ai casi precedenti, ovvero le condizioni
che portano a maggior instabilità sono:
• Aumento del guadagno Kp;
• Diminuzione della costante di tempo τ;
• Aumento del ritardo θ
In presenza degli stessi errori utilizzati nei casi precedenti, con queste ultime due tecniche non è stata
rilevata alcuna instabilità. Si deduce che tali criteri di tuning sono robusti.
CONFRONTO TRA GLI ERRORI NEI VARI TUNING
Il tuning del regolatore è stato eseguito con i parametri: Kp=1; τ=1; θ=2. Si riportano in tabella gli
scostamenti dei margini di guadagno e di fase al variare dei valori dei parametri del processo.
Curva di reazione Curva di risposta Tuning per tentativi Tuning per via
analitica
Errore Errore Errore Errore Errore Errore Errore Errore
G P G P G P G P
M M M M M M M M
Kp·0,8 0,494 8,45 0,494 8,45 0,438 10,7 0,432 10,4
Kp 0 0 0 0 0 0 0 0
Kp·1,2 -0,329 -9,36 -0,329 * -9,36 * -0,292 -9,85 -0,288 -10,3
τ·0,8 -0,084 2,91 -0,084 * -2,91 * 0,008 2,83 -0,0190 2,79
τ 0 0 0 0 0 0 0 0
τ·1,2 0,0818 -2,53 0,0818 -2,53 -0,005 -2,38 0,0190 -2,33
θ·0,8 0,387 8,93 0,387 8,93 0,484 9,84 0,442 10,4
θ 0 0 0 0 0 0 0 0
θ·1,2 -0,272 -8,93 -0,272 * -8,93 * -0,308 -9,84 -0,292 -10,4
*Presenza di instabilità in CL 169
CODICE MATLAB
File fsolvelambda16.m:
function F=fsolvelambda16(x) %BCS lambda minimo per cui si ha Gm=1;
global Kp theta tau s
P=Kp*exp(-theta*s)/(tau*s+1);
taui=theta/2+tau;
Kc=1/Kp*(tau+theta/2/(x(1)+theta));
Kcpi=Kc*(1+1/(taui*s));
Ptot=P*Kcpi;
[Gmtot,Pmtot,wtot]=margin(Ptot);
F(1)=Gmtot-1;
end
File fsolve16.m
function F=fsolve16(X)
global Kp tau theta;
%X=[Kc,taui,phi,wsign,wstar]
Kc=X(1);taui=X(2);wsign=X(3);wstar=X(4);
Astar=Kp*Kc*(sin(theta*wstar)*(1+tau*taui*wstar^2)+cos(theta*wstar)*wstar*(tau-
taui))/((tau^2*wstar^2+1)*(-taui*wstar));
Bstar=Kp*Kc*(cos(-theta*wstar)*(tau*taui*wstar^2+1)+sin(-
theta*wstar)*wstar*(tau-taui))/((tau^2*wstar^2+1)*(-taui*wstar));
F(1)=1/Astar+1.75;
F(2)=tan(-pi)-Bstar/Astar;
%e' stata utilizzata la tan poiche' arctan ha codominio compreso tra pi/2 e -
pi/2;
Asign=Kp*Kc*(sin(theta*wsign)*(1+tau*taui*wsign^2)+cos(theta*wsign)*wsign*(tau-
taui))/((tau^2*wsign^2+1)*(-taui*wsign));
Bsign=Kp*Kc*(cos(-theta*wsign)*(tau*taui*wsign^2+1)+sin(-
theta*wsign)*wsign*(tau-taui))/((tau^2*wsign^2+1)*(-taui*wsign));
F(3)=tan(0.610865)-Bsign/Asign;
F(4)=sqrt(Asign^2+Bsign^2)-1;
end
File es16.m:
clear all;close all;clc;
global Kp theta tau s
s=tf('s');theta=2;tau=1;Kp=1;
% C&C; BCS.
taui=[theta*(30+3*theta/tau)/(9+20*theta/tau)
theta/2+tau
theta/2+tau
theta/2+tau];
Kc=1;
%Guadagno P vs PI
P=Kp*exp(-theta*s)/(tau*s+1);
[Kmp,Pm,w]=margin(P);
Km=Kmp;
for i=1:2
Kcpi=Kc*(1+1/(taui(i)*s));
Ptot=P*Kcpi; 170
[Kmtot,Pmtot,wtot]=margin(Ptot);
Km_tot(i)=Kmtot;
figure(1);nyquist(Ptot);hold on;
legend({'PI: tuning C&C','PI: tuning BCS'},'Location','best');
figure(2);bode(Ptot);hold on;
legend({'PI: tuning C&C','PI: tuning BCS'},'Location','best');
end
figure(3);nyquist(P);
legend({'regolatore P'},'Location','best');
figure(4);bode(P);
legend({'regolatore P'},'Location','best');
Kmp
Km_tot
%tuning curva di reazione vs curva di risposta
[lambda_1]=fsolve(@fsolvelambda16,0.9);
c=lambda_1/theta; %c=1.2784;
lambda=theta*[0.8 c 2*c];
% C&C; BCS.
Kc=[1/Kp*tau/theta*(0.9+theta/(12*tau))
1/Kp*(tau+theta/2/(lambda(1)+theta))
1/Kp*(tau+theta/2/(lambda(2)+theta))
1/Kp*(tau+theta/2/(lambda(3)+theta))];
for i=1:length(Kc)
Kcpi=Kc(i)*(1+1/(taui(i)*s));
Ptot=P*Kcpi;
[Gmtot,Pmtot,wtot]=margin(Ptot);
if Gmtot<1
i,kc=Kc(i)
warning('SISTEMA INSTABILE')
end
Gm_tot(i)=Gmtot;
Pm_tot(i)=Pmtot;
w_tot(i)=wtot;
figure(5);nyquist(Ptot); hold on;
figure(6);bode(Ptot); hold on;
end
legend({'PI: tuning C&C','PI:tuning BCS c=0.8','PI: tuning BCS c=1.2784','PI:
tuning BCS c=2*1.2784'},'Location','best');
figure(5);
legend({'PI: tuning C&C','PI:tuning BCS c=0.8','PI: tuning BCS c=1.2784','PI:
tuning BCS c=2*1.2784'},'Location','best');
Gm_tot
Pm_tot
w_tot
Km_tot(3)=Km_tot(2);
Km_tot(4)=Km_tot(2);
for i=1:length(Kc)
Km_tot(i)/Kc(i)-Gm_tot(i)
end
% il guadagno Gm da' un indice di quanto puo' esser variato il valore
% attuale di Kc rispetto a Km (guadagno globale del processo);
% in altri termini e' un parametro che identifica la stabilita' del
% regolatore e della tipologia di tuning per quel determinato processo;
%curva di reazione Kp span; 171
Kp=Kp*[0.8,1,1.2];Kc=1/Kp(2)*tau/theta*(0.9+theta/(12*tau));
taui1=theta*(30+3*theta/tau)/(9+20*theta/tau);
Kcpi=Kc*(1+1/(taui1*s));
for i=1:length(Kp)
P=Kp(i)*exp(-theta*s)/(tau*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,kp=Kp(i)
warning('SISTEMA INSTABILE')
end
e_Gm_Kp(i)=Gmtot1-Gm_tot(1);
e_Pm_Kp(i)=Pmtot1-Pm_tot(1);
end
e_Gm_Kp
e_Pm_Kp
% tau span
Kp1=1;tau=tau*[0.8,1,1.2]; tau1=1;
for i=1:length(tau)
P=Kp1*exp(-theta*s)/(tau(i)*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,TAU=tau(i)
warning('SISTEMA INSTABILE')
end
e_Gm_tau(i)=Gmtot1-Gm_tot(1);
e_Pm_tau(i)=Pmtot1-Pm_tot(1);
end
e_Gm_tau
e_Pm_tau
% theta span
theta=theta*[0.8,1,1.2];
for i=1:length(theta)
P=Kp1*exp(-theta(i)*s)/(tau1*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,THETA=theta(i)
warning('SISTEMA INSTABILE')
end
e_Gm_theta(i)=Gmtot1-Gm_tot(1);
e_Pm_theta(i)=Pmtot1-Pm_tot(1);
end
e_Gm_theta
e_Pm_theta
%curva di risposta Kp span;
theta1=2; lambda1=theta1*c;
Kp=Kp1*[0.8,1,1.2]; taui1=theta1/2+tau1;
Kc=1/Kp1*(tau1+theta1/2/(lambda1+theta1));
Kcpi=Kc*(1+1/(taui1*s));
for i=1:length(Kp)
P=Kp(i)*exp(-theta1*s)/(tau1*s+1); 172
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,kp=Kp(i)
warning('SISTEMA INSTABILE')
end
e_Gm_Kp(i)=Gmtot1-Gm_tot(3);
e_Pm_Kp(i)=Pmtot1-Pm_tot(3);
end
e_Gm_Kp
e_Pm_Kp
% tau span
tau=tau1*[0.8,1,1.2];
for i=1:length(tau)
P=Kp1*exp(-theta1*s)/(tau(i)*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,TAU=tau(i)
warning('SISTEMA INSTABILE')
end
e_Gm_tau(i)=Gmtot1-Gm_tot(3);
e_Pm_tau(i)=Pmtot1-Pm_tot(3);
end
e_Gm_tau
e_Pm_tau
% theta span
theta=theta1*[0.8,1,1.2];
for i=1:length(theta)
P=Kp1*exp(-theta(i)*s)/(tau1*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,THETA=theta(i)
warning('SISTEMA INSTABILE')
end
e_Gm_theta(i)=Gmtot1-Gm_tot(3);
e_Pm_theta(i)=Pmtot1-Pm_tot(3);
end
e_Gm_theta
e_Pm_theta
File es16_b.m:
clear all;close all;clc;
global Kp tau theta;
s=tf('s');theta=2;tau=1;Kp=1;
t=linspace(0,30,301);
%tuning per tentativi
x=fsolve(@fsolve16,[1 1 0.5 0.5]);
%x=[Kc,taui,wsign,wstar]
taui=x(2); Kc=x(1);
Kcpi=Kc*(1+1/(taui*s)); 173
P=Kp*exp(-theta*s)/(tau*s+1);
Ptot=P*Kcpi;
figure(1);bode(Ptot); hold on;
figure(2);nyquist(Ptot); hold on;
[Gm,Pm,wstar,wsign]=margin(Ptot)
Y=Ptot/(1+Ptot);y=step(Y,t);
figure(3);plot(t,y);hold on;
% tentativi Kp span;
Kp=Kp*[0.8,1,1.2];Kp1=1;
taui1=x(2);
for i=1:length(Kp)
P=Kp(i)*exp(-theta*s)/(tau*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,kp=Kp(i)
warning('SISTEMA INSTABILE')
end
e_Gm_Kp(i)=Gmtot1-Gm;
e_Pm_Kp(i)=Pmtot1-Pm;
end
e_Gm_Kp
e_Pm_Kp
% tau span
tau=tau*[0.8,1,1.2];
for i=1:length(tau)
P=Kp1*exp(-theta*s)/(tau(i)*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,TAU=tau(i)
warning('SISTEMA INSTABILE')
end
e_Gm_tau(i)=Gmtot1-Gm;
e_Pm_tau(i)=Pmtot1-Pm;
end
e_Gm_tau
e_Pm_tau
% theta span
theta=theta*[0.8,1,1.2];tau1=1;
for i=1:length(theta)
P=Kp1*exp(-theta(i)*s)/(tau1*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,THETA=theta(i)
warning('SISTEMA INSTABILE')
end
e_Gm_theta(i)=Gmtot1-Gm;
e_Pm_theta(i)=Pmtot1-Pm;
end
e_Gm_theta
e_Pm_theta 174
%tuning con assegnazione analitica HO
theta1=2;
Gm=1.75;Pm=0.610865; %rad;
wa=(Gm*Pm+pi/2*Gm*(Gm-1))/((Gm^2-1)*theta1);
Kc=wa*tau1/(Gm*Kp1);
taui=1/(2*wa-4*wa^2*theta1/pi+1/tau1);
Kcpi=Kc*(1+1/(taui*s));
P=Kp1*exp(-theta1*s)/(tau1*s+1);
Ptot=P*Kcpi;
figure(1);bode(Ptot);
legend({'tentativi con "Fsolve"','Assegnazione analitica'},'Location','best');
figure(2);nyquist(Ptot);
legend({'tentativi con "Fsolve"','Assegnazione analitica'},'Location','best');
[Gm1,Pm1,wstar1,wsign1]=margin(Ptot)
Y=Ptot/(1+Ptot);y=step(Y,t);
figure(3);plot(t,y);
xlabel('tempo');ylabel('y');
title('Risposta con ingresso a gradino, Tentativi vs Assegnazione analitica');
legend({'Tentativi','Assegnazione analitica'},'Location','best');
% HO Kp span;
Kp=Kp1*[0.8,1,1.2];
taui1=1/(2*wa-4*wa^2*theta1/pi+1/tau1);
for i=1:length(Kp)
P=Kp(i)*exp(-theta1*s)/(tau1*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,kp=Kp(i)
warning('SISTEMA INSTABILE')
end
e_Gm_Kp(i)=Gmtot1-Gm1;
e_Pm_Kp(i)=Pmtot1-Pm1;
end
e_Gm_Kp
e_Pm_Kp
% tau span
tau=tau1*[0.8,1,1.2];
for i=1:length(tau)
P=Kp1*exp(-theta1*s)/(tau(i)*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wtot1]=margin(Ptot);
if Gmtot1<1
i,TAU=tau(i)
warning('SISTEMA INSTABILE')
end
e_Gm_tau(i)=Gmtot1-Gm1;
e_Pm_tau(i)=Pmtot1-Pm1;
end
e_Gm_tau
e_Pm_tau
% theta span
theta=theta1*[0.8,1,1.2];
for i=1:length(theta) 175
P=Kp1*exp(-theta(i)*s)/(tau1*s+1);
Ptot=P*Kcpi;
[Gmtot1,Pmtot1,wto