final project

13
Question No. 1 Design the State Feedback Controller (for the linearized system) and RUN it for both linear and non- linearized systems in Simulink. Data Initialization: m=0.05; k=0.001; g=9.81; a=0.05; Lo=0.01; yss=0.05; m=1.5*m; % mass perturbation uss=(a+yss)*sqrt(2*m*g/(a*Lo)) A=[0 1; 2*g/(a+yss) -k/m] B=[0; -(1/(a+yss))*sqrt(2*Lo*a*g/m)] C=[1 0] D=[0] eig(A) p=[-10; -14]; K=-place(A,B,p) x0=[0.05;0] For Linear System Output: subplot(121) plot(tout,yout(:,1)) title({'State feedback Controller';'applied to Linear model'}) ylabel('Output') xlabel('Time') subplot(122) plot(tout,yout(:,2)) title({'State feedback Controller';'applied to Linear model'}) ylabel('Control') xlabel('Time') For Non-Linear System Output subplot(121) plot(tout,yout(:,1)) title({'State feedback Controller';'applied to Non Linear model'}) ylabel('Output') xlabel('Time') subplot(122) plot(tout,yout(:,2)) title({'State feedback Controller';'applied to Non Linear model'}) ylabel('Control') xlabel('Time')

Upload: umair-zulfiqar

Post on 15-Dec-2015

226 views

Category:

Documents


1 download

DESCRIPTION

LCS Project

TRANSCRIPT

Question No. 1

Design the State Feedback Controller (for the linearized system) and RUN it for both linear and non-

linearized systems in Simulink.

Data Initialization:

m=0.05; k=0.001; g=9.81; a=0.05; Lo=0.01; yss=0.05; m=1.5*m; % mass perturbation uss=(a+yss)*sqrt(2*m*g/(a*Lo)) A=[0 1; 2*g/(a+yss) -k/m] B=[0; -(1/(a+yss))*sqrt(2*Lo*a*g/m)] C=[1 0] D=[0] eig(A) p=[-10; -14]; K=-place(A,B,p) x0=[0.05;0]

For Linear System

Output:

subplot(121)

plot(tout,yout(:,1))

title({'State feedback Controller';'applied to Linear model'})

ylabel('Output')

xlabel('Time')

subplot(122)

plot(tout,yout(:,2))

title({'State feedback Controller';'applied to Linear model'})

ylabel('Control')

xlabel('Time')

For Non-Linear System

Output subplot(121)

plot(tout,yout(:,1))

title({'State feedback Controller';'applied to Non Linear model'})

ylabel('Output')

xlabel('Time')

subplot(122)

plot(tout,yout(:,2))

title({'State feedback Controller';'applied to Non Linear model'})

ylabel('Control')

xlabel('Time')

Question No. 2 Design the Output Feedback Controller (for the linearized system) and RUN it for both linear

non-linearized systems in Simulink.

Data Initialization:

m=0.05; k=0.001; g=9.81; a=0.05; Lo=0.01; yss=0.05; m=1.5*m; % mass perturbation = 50% uss=(a+yss)*sqrt(2*m*g/(a*Lo))

A=[0 1; 2*g/(a+yss) -k/m] B=[0; -(1/(a+yss))*sqrt(2*Lo*a*g/m)] C=[1 0] D=[0] eig(A) p=[-10; -14]; K=-place(A,B,p) x0=[0.05;0] po=[-400 -500]; L=(place(A',C',po))' Ao=A+B*K-L*C Bo=L Co=eye(2) Do=zeros(2,1)

For Linear System

Output subplot(121)

plot(tout,yout(:,1))

title({'Output feedback Controller';'applied to Linear model'})

ylabel('Output')

xlabel('Time')

subplot(122)

plot(tout,yout(:,2))

title({'Output feedback Controller';'applied to Linear model'})

ylabel('Control')

xlabel('Time')

For Non-Linear System

Output

subplot(121)

plot(tout,yout(:,1))

title('Output feedback Controller applied to Non-Linear model')

ylabel('Output')

xlabel('Time')

subplot(122)

plot(tout,yout(:,2))

title('Output feedback Controller applied to Non- Linear model')

ylabel('Control')

xlabel('Time')

Question No. 3 Apply the Integral Control to the State Output Feedback Controller and RUN it for both linear and non-linearized system in Simulink. Data Initialization:

m=0.05; k=0.001; g=9.81; a=0.05; Lo=0.01; yss=0.05; m=1.5*m; % mass perturbation = 50% uss=(a+yss)*sqrt(2*m*g/(a*Lo))

A=[0 1; 2*g/(a+yss) -k/m] B=[0; -(1/(a+yss))*sqrt(2*Lo*a*g/m)] C=[1 0] D=[0] eig(A) x0=[0.05;0] po=[-400 -500]; L=(place(A',C',po))' A_hat=[A zeros(2,1); -C 0] B_hat=[B;0] p=[-14;-12;-10] K=-place(A_hat,B_hat,p) Ao=[A+B*K(1,1:2)-L*C zeros(2,1);zeros(1,3)] Bo=[L;-1] Co=K Do=0

Integral Control of Output feedback Controller: Linear model Output subplot(121) plot(tout,yout(:,1)) title({'Integral Control of';'Output feedback Controller';'Linear model'}) ylabel('Output') xlabel('Time') subplot(122) plot(tout,yout(:,2)) title({'Integral Control of';'Output feedback Controller';'Linear model'}) ylabel('Control') xlabel('Time')

Integral Control of Output feedback Controller: Non Linear model Output subplot(121) plot(tout,yout(:,1)) title({'Integral Control of';'Output feedback Controller';'Non Linear

model'}) ylabel('Output') xlabel('Time') subplot(122) plot(tout,yout(:,2)) title({'Integral Control of';'Output feedback Controller';'Non Linear

model'}) ylabel('Control') xlabel('Time')

Integral Control of State feedback Controller: Linear model Output subplot(121) plot(tout,yout(:,1)) title({'Integral Control of';'State feedback Controller';'applied to Linear

model'}) ylabel('Output') xlabel('Time')

subplot(122) plot(tout,yout(:,2)) title({'Integral Control of';'State feedback Controller';'applied to Linear

model'}) ylabel('Control') xlabel('Time')

Integral Control of State feedback Controller: Non Linear model

Output subplot(121) plot(tout,yout(:,1)) title({'Integral Control of';'State feedback Controller';'applied to Non

Linear model'}) ylabel('Output') xlabel('Time')

subplot(122) plot(tout,yout(:,2)) title({'Integral Control of';'State feedback Controller';'applied to Non

Linear model'}) ylabel('Control') xlabel('Time')

Question No.4

For the Linear system, apply the Servomechanism. (Disturbance Magnitude=10)

Data Initialization:

m=0.05; k=0.001; g=9.81; a=0.05; Lo=0.01; yss=0.05; m=1.5*m; % mass perturbation = 50% uss=(a+yss)*sqrt(2*m*g/(a*Lo))

A=[0 1; 2*g/(a+yss) -k/m] B=[0; -(1/(a+yss))*sqrt(2*Lo*a*g/m)] C=[1 0] D=[0] eig(A) x0=[0.05;0] po=[-400 -500]; L=(place(A',C',po))'

A_hat=[A zeros(2,1); -C 0] B_hat=[B;0] p=[-14;-12;-10] K=-place(A_hat,B_hat,p) Ao=A+B*K(1,1:2)-L*C Bo=L Co=eye(2) Do=zeros(2,1)

REFERENCE : [1] Linear State-Space Control Systems By Robert L. Williams II Douglas A. Lawrence [2] Modern Control Engineering By Katsuhiko Ogata

Output

subplot(121) plot(tout,yout(:,1)) title({'Reference Input applied';'to Linear model'}) ylabel('Reference') xlabel('Time')

subplot(122) plot(tout,yout(:,2)) title({'Observer based Servomechanism';'applied to Linear model'}) ylabel('Output') xlabel('Time')

Question No.5 Apply Regulation for Part1 and Part2. Input to be taken is a Unit Step. Data Initialization

m=0.05; k=0.001; g=9.81; a=0.05; Lo=0.01; yss=0.05;

uss=(a+yss)*sqrt(2*m*g/(a*Lo)) m=1.5*m; % mass perturbation A=[0 1; 2*g/(a+yss) -k/m] B=[0; -(1/(a+yss))*sqrt(2*Lo*a*g/m)] C=[1 0] D=[0] eig(A) p=[-10; -14]; K=-place(A,B,p) x0=[0.05;0] po=[-600 -700]; L=(place(A',C',po))'

Ao=A+B*K-L*C Bo=L Co=eye(2) Do=zeros(2,1) N=-1/(C*inv(A+B*K)*B)

Regulation of State Feedback : Linear Model Output: subplot(121) plot(tout,yout(:,2)) title('Regulation of Linear State Feedback') ylabel('Reference') xlabel('Time')

subplot(122) plot(tout,yout(:,1)) title('Reference Tracking') ylabel('Output') xlabel('Time')

Regulation of State Feedback : Non Linear Model Output: subplot(121) plot(tout,yout(:,2)) title('Regulation of Non Linear State Feedback') ylabel('Reference') xlabel('Time')

subplot(122) plot(tout,yout(:,1)) title('Reference Tracking') ylabel('Output') xlabel('Time')

Regulation of Output Feedback : Linear Model Output: subplot(121) plot(tout,yout(:,2)) title('Regulation of Linear Output Feedback') ylabel('Reference') xlabel('Time')

subplot(122) plot(tout,yout(:,1)) title('Reference Tracking') ylabel('Output') xlabel('Time')