Académique Documents
Professionnel Documents
Culture Documents
for i=1:11
hA1(i)=(k1^2*a1(i)^2)/(k2^2*A2o^2*2*g);
hA2(i)=(k1^2*A1o^2)/(k2^2*a2(i)^2*2*g);
k=k+1;
end
figure
t=0:0.1:1;
subplot(2,1,1);
plot(t,hA1),grid
axis([0 1 0 1]);
title('Variacion en la valvula de entrada a1');
ylabel('Altura (h)');
xlabel('Abertura da Valvula a1');
subplot(2,1,2);
plot(t,hA2),grid
axis([0 1 0 1]);
title('Variacion de la valvula de entrada a2');
ylabel('Altura (h)');
xlabel('Abertura da Valvula a2');
%% Processo de Simulação
tsim=400; %tempo de simulaion
tA1=100; %tiempo en que varia a1
tA2=250; %tiempo en que varia a2
dA1=0.5; %variacion de a1
dA2=0.05; %variacion de a2
simulando
sim('tanque1');
%resultados prsentados en graficas
figure
subplot(3,1,1);
plot(t,rY(:,1),t,rY(:,3)),grid
title('Nível do Tanque');
ylabel('Altura (h)');
xlabel('Tempo (s)');
legend('Não Linear','Linear');
subplot(3,1,2);
plot(t,rY(:,2)),grid
title('Abertura em a1');
ylabel('% a1');
xlabel('Tempo (s)');
subplot(3,1,3);
plot(t,rY(:,4)),grid
title('Abertura em a2');
ylabel('% a2');
xlabel('Tempo (s)');
clc
%Controle Proporcional
tsim=120; %tempo de simulacion
Kc=100;
%Simulacion
sim('tanque_Kc');
%Grafica dos resultados
figure
subplot(2,1,1);
plot(t,rY(:,1),t,rY(:,2)),grid
title('Controle Kc=100');
ylabel('Altura (h)');
xlabel('Tempo (s)');
subplot(2,1,2);
plot(t,rY(:,3)),grid
ylabel('Abertura A2');
xlabel('Tempo (s)');
%Controle PI
Tau=A/((k2*A2o*sqrt(2*g))/(2*sqrt(Ho)));
Kp=k1/((k2*A2o*sqrt(2*g))/(2*sqrt(Ho)));
Tr=Tau/5;
Ti=Tau;
Kc=Ti/(Kp*Tr);
%simulacion
sim('tanque_PI_Can');
%Grafica dos resultados
figure
subplot(3,1,1);
plot(t,rY(:,1),t,rY(:,2)),grid
title('Controle PI Cancelamento');
ylabel('Altura (h)');
xlabel('Tempo (s)');
subplot(3,1,2);
plot(t,rY(:,4)),grid
ylabel('Controle');
xlabel('Tempo (s)')
subplot(3,1,3);
plot(t,rY(:,3)),grid
ylabel('Abertura A2');
xlabel('Tempo (s)')
YR=minreal((C*P)/(1+C*P));
YQ=minreal((Q)/(1+C*P));
figure
subplot(2,2,1)
pzmap(YR);
title('DPZ_R');
subplot(2,2,2)
rlocus(YR);
subplot(2,2,3)
pzmap(YQ);
title('DPZ_Q');
subplot(2,2,4)
rlocus(YQ);
Kc=(Pds(2)*Tau-1)/Kp; %Calculo de Kc
Ti=(Kp*Kc)/(Pds(3)*Tau); %Calculo de ti
%simulacion
sim('tanque_PI_Can');
%Grafica dos resultados
figure
subplot(3,1,1);
plot(t,rY(:,1),t,rY(:,2)),grid
title('Control PI Polos Raicess Igualess');
ylabel('Altura (h)');
xlabel('Tempo (s)');
subplot(3,1,2);
plot(t,rY(:,4)),grid
ylabel('Control');
xlabel('Tiempo (s)')
subplot(3,1,3);
plot(t,rY(:,3)),grid
ylabel('Abertura A2');
xlabel('Tiempo (s)')
YR=minreal((C*P)/(1+C*P));
YQ=minreal((Q)/(1+C*P));
figure
subplot(2,2,1)
pzmap(YR);
title('DPZ_R');
subplot(2,2,2)
rlocus(YR);
subplot(2,2,3)
pzmap(YQ);
title('DPZ_Q');
subplot(2,2,4)
rlocus(YQ);