150 likes | 345 Views
Regulacija sustava tri elastično spregnute mase. Opća teorija sustava. Sustav od tri elastično spregnute mase. Regulacija po stanju primjenom metode podešavanja polova. A=[0 1 0 0 0 0 -(k1+k12)/m1 0 k12/m1 0 0 0 0 0 0 1 0 0 k12/m2 0 -(k12+k23)/m2 0 k23/m2 0 0 0 0 0 0 1
E N D
Regulacija sustava tri elastično spregnute mase Opća teorija sustava
Regulacija po stanju primjenom metode podešavanja polova A=[0 1 0 0 0 0 -(k1+k12)/m1 0 k12/m1 0 0 0 0 0 0 1 0 0 k12/m2 0 -(k12+k23)/m2 0 k23/m2 0 0 0 0 0 0 1 0 0 k23/m3 0 -(k2+k23)/m3 0] B=[0 0 0 0 0 1/m3] C=[1 0 0 0 0 0] p=[-1 -1.2 -1.3 -1.4 -1.5 -1.6]; % polovi regulatora K=place(A,B,p) % matrica pojacanja regulatora R = -inv(C*inv(Ar)*B)
% regulacija stanja tromasenog sustava clear all clc close all T=20; k1=1; k12=1.3; k23=1.7; k2=1; % konstante opruga m1=1; m2=2; m3=3; % mase A=[0 1 0 0 0 0 -(k1+k12)/m1 0 k12/m1 0 0 0 0 0 0 1 0 0 k12/m2 0 -(k12+k23)/m2 0 k23/m2 0 0 0 0 0 0 1 0 0 k23/m3 0 -(k2+k23)/m3 0] B=[0 0 0 0 0 1/m3] C=[1 0 0 0 0 0] figure(1) subplot(231), plot(tout,Xsys(:,1),'b',tout,Yref(:,1), 'r--', 'linewidth',3), ylabel('x_1 [m]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(232), plot(tout,Xsys(:,3), 'b', 'linewidth',3), ylabel('x_3 [m]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(233), plot(tout,Xsys(:,5), 'b', 'linewidth',3), ylabel('x_5 [m]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(234), plot(tout,Xsys(:,2), 'b', 'linewidth',3), ylabel('x_2 [m/s]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(235), plot(tout,Xsys(:,4), 'b', 'linewidth',3), ylabel('x_4 [m/s]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(236), plot(tout,Xsys(:,6), 'b', 'linewidth',3), ylabel('x_6 [m/s]','FontSize',14), xlabel('t [s]','FontSize',14); figure(2) subplot(221), plot(tout,U(:,1), 'linewidth',2), ylabel('u_1 [N]','FontSize',14,'FontName','Times'), xlabel('t [s]','FontSize',14); subplot(222), plot(tout,Yout(:,1), 'b', 'linewidth',3), ylabel('y [m]','FontSize',14), xlabel('t [s]','FontSize',14); % ********* x01 = 0.0; x02 = 0; x03 = 0; x04 = 0; x05 = 0; x06 = 0; X0=[x01+0.0 x02 x03 x04 x05 x06]; % pocetni uvjeti sustava %-----B: Linear Regulator ------ p=[-1 -1.2 -1.3 -1.4 -1.5 -1.6]; % polovi regulatora K=place(A,B,p) % matrica pojacanja regulatora Ar=A-B*K; R = -inv(C*inv(Ar)*B) Ystac = 1; % referentno stanje pozicije prve mase %-----E: Linear Regulator------- sim('trimassobs01') % simulink model
Dinamika sustava u prostoru stanja A=[0 1 0 0 0 0 -(k1+k12)/m1 0 k12/m1 0 0 0 0 0 0 1 0 0 k12/m2 0 -(k12+k23)/m2 0 k23/m2 0 0 0 0 0 0 1 0 0 k23/m3 0 -(k2+k23)/m3 0] B=[0 0 0 0 0 1/m3] C=[1 0 0 0 0 0]
Observer stanja pobs=[-1 -2 -3 -4 -5 -6]; % polovi observera LL=place(A',C',pobs); L=LL' % matrica pojacanja observera
Regulator stanja p=[-1 -1.2 -1.3 -1.4 -1.5 -1.6]; % polovi regulatora K=place(A,B,p) % matrica pojacanja regulatora R = -inv(C*inv(Ar)*B)
% output regulacija primjenom observera stanja tromasenog sustava clear all clc close all T=20; k1=1; k12=1.3; k23=1.7; k2=1; % konstante opruga m1=1; m2=2; m3=3; % mase A=[0 1 0 0 0 0 -(k1+k12)/m1 0 k12/m1 0 0 0 0 0 0 1 0 0 k12/m2 0 -(k12+k23)/m2 0 k23/m2 0 0 0 0 0 0 1 0 0 k23/m3 0 -(k2+k23)/m3 0] B=[0 0 0 0 0 1/m3] C=[1 0 0 0 0 0] % ********* x01 = 0.0; x02 = 0; x03 = 0; x04 = 0; x05 = 0; x06 = 0; X0=[x01+0.0 x02 x03 x04 x05 x06]; % pocetni uvjeti sustava X0_obs=[x01 x02 x03 x04 x05 x06]; % pocetni uvjeti observera %-----B: Linear Regulator plus Observer------- p=[-1 -1.2 -1.3 -1.4 -1.5 -1.6]; % polovi regulatora pobs=[-1 -2 -3 -4 -5 -6]; % polovi observera K=place(A,B,p) % matrica pojacanja regulatora LL=place(A',C',pobs); L=LL' % matrica pojacanja observera Ar=A-B*K; R = -inv(C*inv(Ar)*B) Ystac = 1; % referentno stanje pozicije prve mase %-----E: Linear Regulator------- sim('trimassobs01') % simulink model
figure(1) subplot(231), plot(tout,Xsys(:,1), 'b', tout,Xobs(:,1), 'r:', tout,Yref(:,1), 'g--', 'linewidth',3), ylabel('x_1 [m]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(232), plot(tout,Xsys(:,3), 'b', tout,Xobs(:,3), 'r:', 'linewidth',3), ylabel('x_3 [m]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(233), plot(tout,Xsys(:,5), 'b', tout,Xobs(:,5), 'r:', 'linewidth',3), ylabel('x_5 [m]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(234), plot(tout,Xsys(:,2), 'b', tout,Xobs(:,2), 'r:', 'linewidth',3), ylabel('x_2 [m/s]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(235), plot(tout,Xsys(:,4), 'b', tout,Xobs(:,4), 'r:', 'linewidth',3), ylabel('x_4 [m/s]','FontSize',14), xlabel('t [s]','FontSize',14); subplot(236), plot(tout,Xsys(:,6), 'b', tout,Xobs(:,6), 'r:', 'linewidth',3), ylabel('x_6 [m/s]','FontSize',14), xlabel('t [s]','FontSize',14); figure(2) subplot(221), plot(tout,U(:,1), 'linewidth',2), ylabel('u_1 [N]','FontSize',14,'FontName','Times'), xlabel('t [s]','FontSize',14); subplot(222), plot(tout,Yout(:,1), 'b', tout,Yobs(:,1), 'r:', 'linewidth',3), ylabel('y, y_{obs} [m]','FontSize',14), xlabel('t [s]','FontSize',14);