Second Test Control 2
Second Test Control 2
I. I NTRODUCTION
Figura 1. Plant in space state
The control law is useful in a lot of cases, using this
law a plant can be controlled using only one input and
one output because a software tool is used to compute
and simulate the behavior of the plant, there is no need
to feedback all the state variables, this approach gives a
lot of advantages against the traditional approach, using
this law almost every plant can be controlled.
The main goal in this document is to evaluate the
plants presented, interpret them and design the contro-
llers to obtain the desired outputs in the right way
Figura 6. Desired parameters of the plant Figura 10. Ki gain of the controller
Figura 11. Observer and its poles
[b]
[b]
Figura 62. Outputs of the systems and control actions
A P ÉNDICE
% # Para el sistema
a=[0,1,0,0;0,-5,0,0;0,0,0,1;0,0,0,-2]
b=[0,0;0.5,0;0,0;0,0.5]
c=[1,0,0,0;0,0,1,0]
d = [0,0;0,0]
% pd=[-1,-2]
%%
% Comando para controlabilidad
co=ctrb(a,b)
rangoco=rank(co)
if rangoco==length(a)
disp ("el sistema es controlable")
else disp ("el sistema no es controlable")
end
%%
% Comando para observabilidad
ob=obsv(a,c)
rangoob=rank(ob)
if rangoob==length(a)
disp ("el sistema es observable")
else disp ("el sistema no es observable")
end
%%
% Hallo cita
cita= abs(log (0.1))/(sqrt((piˆ2 + (log (0.1))ˆ2)))
ts= 38
%%
% Hallo wn
wn= 4/(cita * ts)
Listing 1: Second question code part 1
%%
% Ec deseada es sˆ2+(2*cita*wn)+wnˆ2
%
% Escribo la EC deseada
N = 1
D = [1 (2*cita*wn) wnˆ2]
format long
ecdes= tf(N,D)
%%
% Saco polos deseados
polos = roots(D)
p1= polos(1:1)
p2= polos(2:2)
pd=[p1 p2]
%%
% Seguidor multivariable
%
% Seguidor
aa=[a,zeros(4,1);-c,0]
ba=[b;zeros(2,2)]
pda=[pd,-20,-25,-30]
kt=place(aa,ba,pda)
kp=kt(1:1,1:4)
ki=kt(1:1,5:6)
%%
% Observador
po=[-20,-21,-22,-23]
h=place(a',c',po)
h=h'
Listing 2: Second question code part 2
% # Para el sistema
a=[0,1,0,0;3,0,0,2;0,0,0,1;0,-2,-3,0]
b=[0;1;0;0]
c=[1,0,0,0]
d=[0]
%%
% Paso a funcion de transferencia
[num,den]=ss2tf(a,b,c,0)
ft=tf(num,den)
stability = isstable(ft)
if stability ==1
disp ("El sistema es estable")
else disp ("El sistema es inestable")
end
polosGc=pole(ft)
pzplot(ft)
% Comando para controlabilidad
co=ctrb(a,b)
rangoco=rank(co)
if rangoco==length(a)
disp ("el sistema es controlable")
else disp ("el sistema no es controlable")
end
% Comando para observabilidad
ob=obsv(a,c)
rangoob=rank(ob)
if rangoob==length(a)
disp ("el sistema es observable")
else disp ("el sistema no es observable")
end
% Graficar la salida y para una entrada escalon
step(ft)