21
Longitudinal Control of an Aircraft and Controlling a 2D Robot Shilpa Marti EE 5143 Linear Systems and Controls December 9, 2014

Longitudinal Control of an Aircraft and Controlling a 2D Robot

Embed Size (px)

DESCRIPTION

project using matlab for linear systems and control course in EE

Citation preview

Page 1: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot

Shilpa Marti

EE 5143 Linear Systems and Controls

December 9, 2014

Page 2: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 1 of 20

Abstract

The equations governing the motion of an aircraft and the 2D Robot requires complex

nonlinear coupled differential equations [1] . However, under certain assumptions, they can

be decoupled and linearized into longitudinal and lateral equations for aircraft and position,

velocity for robot in x and y direction. In this part of the project we will focus on the

simplified linear equation of modeling the longitudinal motion of a transport aircraft and

designing the trajectory following controller for Robot.

Page 3: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 2 of 20

Introduction

Longitudinal Control of Aircraft

An aircraft is assumed to be disturbed from its steady state flight condition. These

perturbations are considered to be small from the reference position in order to obtain a set

of linear differential equations.

In longitudinal mode the oscillating motions can be described by two parameters[2]

Phugoid and Short-term.

In Phugoid mode the oscillations have longer periods and large amplitude variation of air-

speed, pitch angle, and altitude, though the damping is weak the period is very long for the

pilot to control the oscillations of the aircraft.

The linear differential equation of the longitudinal motion in Phugoid mode is given below

∆�̇��̇��̇�

∆�̇�

⌉ =

⌈⌈⌈⌈

𝑋𝑢

𝑚

𝑋𝑤

𝑚0 −𝑔

𝑍𝑢

𝑚

𝑍𝑤

𝑚𝑢0 0

𝑀𝑢 𝑀𝑤 0 00 0 1 0 ⌉

⌉⌉⌉

∆𝑢𝑤𝑞∆𝜃

⌉ (1.0)

Where ∆𝑢 = 𝑉𝑒𝑙𝑜𝑐𝑖𝑡𝑦 𝑚𝑎𝑔𝑛𝑖𝑡𝑢𝑑𝑒 𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑡ℎ𝑒 𝑑𝑖𝑟𝑒𝑐𝑡𝑖𝑜𝑛 𝑜𝑓 𝑎𝑖𝑟𝑐𝑟𝑎𝑓𝑡

𝑤 = 𝑎𝑙𝑡𝑖𝑡𝑢𝑑𝑒 𝑣𝑒𝑙𝑜𝑐𝑖𝑡𝑦 𝑐ℎ𝑎𝑛𝑔𝑒

𝑞 = 𝑝𝑖𝑡𝑐ℎ 𝑎𝑛𝑔𝑢𝑙𝑎𝑟 𝑣𝑒𝑙𝑜𝑐𝑖𝑡𝑦

∆𝜃 = 𝑝𝑖𝑐ℎ 𝑎𝑛𝑔𝑙𝑒 𝑐ℎ𝑎𝑛𝑔𝑒

Page 4: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 3 of 20

Trajectory following controller for 2D- Robot

For a 2D Robot the linearized model in the position and velocity parameters are given as

follows

⌈⌈⌈⌈ 𝑃𝑥(𝑡)̇

𝑃𝑦(𝑡)̇

𝑣�̇�

𝑣�̇� ⌉⌉⌉⌉

= ⌈

0 0 1 00 0 0 10 0 0 00 0 0 0

⌉ ⌈𝑥(𝑡)⌉ +

0 00 01 00 1

[𝑢𝑥(𝑡)

𝑢𝑦(𝑡)] (1.1)

THEORY

This project consist of solving two different problems.

1. Using equation (1) that models the longitudinal motion of an aircraft and simulate

the state trajectories with elevator control input ue(t) and the propulsion, up(t).

Calculate the change of altitude of the transport aircraft.

2. Designing a trajectory following controller that follows a 2D Robot that has the

coordinates for starting at a certain location and ending at another.

Page 5: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 4 of 20

METHODOLOGY

Eigenvalues and Eigen Vectors

The small disturbance equations for the longitudinal control of aircraft are given by[3]

𝑋 = 𝐴𝑥 + ∆𝑓𝑐̇ (2)

𝑤ℎ𝑒𝑟𝑒 𝑥 𝑖𝑠 (𝑁𝑋1)𝑠𝑡𝑎𝑡𝑒 𝑣𝑒𝑐𝑡𝑜𝑟

A is (N x N) system matrix

The solutions for the first order differential equations is

X(t) = X0eλt (3)

Where X0 is the eigenvector

λ is the eigenvalue of the system

Since the equation is linear the general solution for X (t) = ∑ X0𝑖𝑒λ𝑖t 𝑖 (4)

Depending upon the value of λ one can determine whether the system has a static instability or divergence that increase with time, or a subsidence or a convergence that ultimately diminishes with time and the disturbance quantity approaches to zero.

This evaluation of stability is obtained from the inspection of eigenvalues. If there are no positive real parts of the λ’s then the system is stable.

Eigen vectors are useful in modal decomposition of the system, thus determining the effect of eigenvalue on a particular state variables.

In Phugoid mode it is observed from the eigenvectors that altitude velocity change (w) and pitch angular velocity (q) remain small but Δu and Δθ are present with significant magnitude.

Transition Matrix

In control theory, the state-transition matrix is a matrix whose product with the state

vector at an initial time gives at a later time. The state-transition matrix can be used to

obtain the general solution of linear dynamical systems. It is also known as the matrix

exponential. [5]

Page 6: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 5 of 20

Controllability and Observability

Controllability and observability represent two major concepts of modern control system

theory. These concepts were introduced by R. Kalman in 1960. They can be roughly defined

as follows.

Controllability: In order to be able to do whatever we want with the given dynamic system

under control input, the system must be controllable.

Observability: In order to see what is going on inside the system under observation, the

system must be observable.[4]

Control Inputs

The importance of knowing if a system is controllable is that then it is known that the

system can be driven from one state to the next. In order to do this we must find a controller

to in the form of:

𝑢(𝑡)=−𝐵𝑇𝑒𝐴^𝑇(𝑡𝑓−𝑡)𝑊𝑐−1(𝑡𝑓)(𝑒𝐴𝑡𝑓𝑥0−𝑥𝑓) (5)

To take the state from x(0) to x(100sec),as the problem requires(this is shown in Problem 1

part 4 in the appendix). The equation above requires that 𝑒𝐴^𝑇(𝑡𝑓−𝑡), 𝑒𝐴𝑡𝑓 , and 𝑊𝑐−1 be

calculated for. The first two are easy to find, but the last one requires the use of the

following equation:

𝑊𝑐 = ∫ 𝑒𝐴(𝑡𝑓−𝜏) ∗ 𝐵 ∗ 𝐵𝑇 ∗ 𝑒𝐴𝑇(𝑡𝑓−𝜏)𝑑𝜏𝑡

0 (6)

In order to find the sequence of inputs for a given time interval, the t and tf must be changed

to the corresponding time interval. In this case it would be 0.5sec and 1.0sec, respectively

(calculations are shown in Problem 1 part 6 of the appendix).

Page 7: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 6 of 20

State Trajectories

Evolution of dynamic system corresponds to a trajectory in the phase system. Different

initial states result in different trajectories. Now in order to be able to plot the state

trajectories, the discrete time form must be solved for and used to be modeled into MATLAB

(graphs are shown in Problem 1 part 7 of the appendix). Lastly, the change of altitude can be

found by using the equation:

𝑧 = 𝑧𝑐𝑢𝑟𝑟𝑒𝑛𝑡 + 𝜔 ∗ 𝑒𝑙𝑎𝑝𝑠𝑒𝑑_𝑡𝑖𝑚𝑒

Feedback pole placement controller for a 2D Robot

When a system is governed by a state space model as given in (1.1) it can be verified

whether it is asymptotically stable or not. A system is asymptotically stable if, for an

identical zero input, the system will converge to zero from any initial state. For a linear time

invariant system described by model (1.1) it is asymptotically stable if the eigenvalues have

negative real parts.

Since the system here is both controllable and observable it can be assumed that the

realization of the system is minimal and under these assumptions the system is both BIBO

stable and asymptotically stable , hence the poles should be in the left half of the complex

plane thus they are chosen as p=[-1 -2 -3 -4].

Next, a controller is used to follow a designated trajectory that follows different sets of

equations that that move it in the x and y direction. In order to simulate the state dynamics

of the continuous time model it should be converted into a discrete time model (shown in

Problem 2 part 5 of the appendix). Then dynamics of the states can be observed for 30

seconds; the graphs are displayed in Problem 2 part 6 of the appendix.

Page 8: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 7 of 20

RESULTS AND ANALYSIS

Longitudinal control of an aircraft

Eigenvalues : -0.3719 + 0.8875i

-0.3719 - 0.8875i

-0.0033 + 0.0673i

-0.0033 - 0.0673

Eigen Vectors:

0.0212 + 0.0167i 0.0212 - 0.0167i -0.9983 + 0.0000i -0.9983 + 0.0000i

0.9996 + 0.0000i 0.9996 + 0.0000i -0.0573 + 0.0097i -0.0573 - 0.0097i

-0.0001 + 0.0011i -0.0001 - 0.0011i -0.0001 - 0.0000i -0.0001 + 0.0000i

0.0011 - 0.0004i 0.0011 + 0.0004i 0.0001 + 0.0021i 0.0001 - 0.0021i

Page 9: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 8 of 20

Stability of Eigenvalues:

Figure 1

Eigen values lie to the left hand side of the S plane, hence stable.

The system is controllable. Rank is 4

Wc =

-0.0002 9.6600 -0.2490 -0.0663 24.9806 -0.0117 -7.3199 -0.0206

-17.8500 0 -890.6443 -0.8747 678.8905 1.1691 320.4207 -0.0591

-1.1580 0 0.5145 0.0011 0.6933 0.0004 -0.9907 -0.0014

0 0 -1.1580 0 0.5145 0.0011 0.6933 0.0004

Page 10: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 9 of 20

ad =

0.9993 0.0014 -0.1065 -3.2289

-0.0085 0.9651 74.4752 0.0140

0.0000 -0.0001 0.9542 -0.0000

0.0000 -0.0000 0.0978 1.0000

bd =

0.0029 0.9657

-6.1238 -0.0042

-0.1131 0.0000

-0.0057 0.0000

Plots for state trajectories

Figure 2

Page 11: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 10 of 20

Figure 3

Figure 4

Page 12: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 11 of 20

Figure 5

Figure 6

Page 13: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 12 of 20

Trajectory following 2D Robot

System is observable

Ob = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 System is controllable

Co = 0 0 1 0 0 0 0 0

0 0 0 1 0 0 0 0

1 0 0 0 0 0 0 0

0 1 0 0 0 0 0 0

Feedback pole placement controller

12.0000 0 7.0000 0

0 2.0000 0 3.0000

ad = 1 0 2 0 bd = 2 0

0 1 0 2 0 2

0 0 1 0 2 0

0 0 0 1 0 2

Page 14: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 13 of 20

The next plots are those of the state trajectories.

Output in the x and y direction:

Figure 7

Figure 8

Velocity in the x and y direction, respectively:

Figure 9

Page 15: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 14 of 20

Figure 10

The above results are for sample period 2 sec and the system becomes unstable for sample

period 0.1 sec

Future research

The significance of being able to calculate the motion of a robot allows for the

understanding for more complex and precise intelligent robots that not only follow what

the user inputs but also learns from its past inputs to follow a different path. Robots are

used in many different types of applications that help improve the lives of people it was

created for. Knowing how to control a 2D robot simply leads the way to building more

complex designs that will improve the lives of others.

Page 16: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 15 of 20

Conclusion

Linearized model of the longitudinal variables of aircraft are analyzed. The determining

factors of stability were analyzed. The state trajectories obtained from the linear simulation

portrayed the variation of state parameters over time. The feedback controller was

designed to enable the trajectory following controller. The trajectories for position and

velocity were observed and obtained the desired output.

Page 17: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 16 of 20

Appendices

MATLAB CODE:

%%-------linear modelling of longitudinal control of aircraft--------%%% %%Author--Shilpa Marti / @01423803

%% % * Eigen values % * Eigen vectors % * Stability

%delta_u=velocity change %w= altitude velocity change %q=pich angular velociy change %delta_0=pitch angle change clc; clear all; close all;

A= [ -0.006868 0.01395 0 -32.3; -0.09055 -0.3151 773.98 0; 0.0001187 -0.001026 -0.4285 0; 0 0 1 0];

B= [-0.000187 9.66; -17.85 0; -1.158 0; 0 0 ]; X0=[0;0;0;0]; Xf=[50;5;1*(pi/180);15*(pi/180)];

[V,D]= eig(A) disp (eig(A)) plot( eig(A), 'o') % State Transition Matrix using similarity transformation; % M= [Re(V1),Im(V1),Re(V2),Im(V2)] M= [0.0212 0.9996 -0.0001 0.0011;0.0167 0 0.0011 -0.0004; -0.9983 -0.0573 -0.001 0;0 0.0097 -0 0.0021] syms t; k=sym('k'); exAt= [exp(-0.372*t)*cos(0.888*t) exp(-0.372*t)*sin(0.888*t) 0 0 ; -exp(-0.372*t)*sin(0.888*t) exp(-0.372*t)*cos(0.888*t) 0 0 ; 0 0 exp(-0003*t)*cos(0.067*t) -exp(-0.003*t)*sin(0.067*t); 0 0 exp(-0.003*t)*sin(0.067*t) exp(-0.003*t)*cos(0.067*t)] Q= simplify(exAt)

phi= M*Q/M trans_matrix=simplify(phi)

%% % *CONTROLLABILITY* % system is controllable if the pair (A,B) is controllable % Rank of the matrix $$ Wc= [ B, AB,A^2B,A^3B]=n $$ Wc= ctrb(A,B) rank (Wc)

Page 18: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 17 of 20

[ad,bd]=c2d(A,B,0.1) %% % * CONTROL INPUT* %to compute the control input to bring the state from x(0)= [0 0 0 0]T to %x(f)= [ 50m/s 5m/s 1/s 15] % we use tau=sym('tau'); wctf=int(expm(A*(100-tau))*B*(B')*expm(A'*(100-tau)),0,100); wctf1=inv(wctf); for i=0.5:0.5:100 k=i*2; u(:,k)=-((B')*expm(A'*(100-i))/wctf)*(expm(A*100)*X0-Xf); end U=double(u); sys = ss(a,b,c,d);

[y,tsim,x] = lsim(sys,U,T);

figure(1);

%7

plot(tsim,x(:,1));

xlabel('Time');

ylabel('Velocity Magnitude Change');

figure(2);

plot(tsim,x(:,2));

xlabel('Time');

ylabel('Altitude Velocity Change');

figure(3);

plot(tsim,x(:,3));

xlabel('Time');

ylabel('Pitch Angular Velocity');

figure(4);

plot(tsim,x(:,4));

xlabel('Time');

ylabel('Pitch Angle Change');

%6

figure(5);

plot(tsim,U);

title('Input Sequence');

xlabel('Time');

ylabel('Inputs');

Page 19: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 18 of 20

Part 2: Controlling a 2D robot

% * 2D control of a robot * %% %x?(t) =[ p?x(t) = [ 0 0 1 0 x(t) + [ 0 0 [ux(t) % p?y(t) 0 0 0 1 0 0 uy(t) ] % v?x 0 0 0 0 1 0 % v?y ] 0 0 0 0 ] 0 1] % % z(t) = _[ 1 0 0 0 [ px(t) % 0 1 0 0 ] py(t) % vx(t) % vy(t) ]

%% clc; clear all; close all;

A =[0 0 1 0;0 0 0 1;0 0 0 0;0 0 0 0]; B=[0 0;0 0;1 0;0 1]; C=[1 0 0 0;0 1 0 0]; D= [0 0 ; 0 0] sys = ss ( A, B, C ,D) Ob= obsv(sys) if(rank(Ob)==4) sprintf('observable') else sprintf('unobservable') end Co = ctrb(sys) if(rank(Ob)==4) sprintf('controllable') else sprintf('uncontrollable') end %%

tfsys= tf(sys) pole(sys) Pnew =[-1; -2; -3; -4]; % for asymptotic stability poles should %negative real numbers. k = [A,B,Pnew]

%P=(C*((-A+B*k)^-1)*B)^-1; t=2; [ad,bd]=c2d(A,B,t)

Page 20: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 19 of 20

Designing a controller using simulink

For inputs

a. px(t) = 5cos(t)

and

py(t) = 5sin(t)

b. px(t) = 10t + 4t2

and

py(t) = 5t + 2t2

Figure 11

Page 21: Longitudinal Control of an Aircraft and Controlling a 2D Robot

Longitudinal Control of an Aircraft and Controlling a 2D Robot | Shilpa Marti

Page 20 of 20

References

1. [Bernard Etkin and Lloyd Duff Reid].[1996]. [Dynamics of Flight stability and

control] 3rd edition. [ 110-115]

2. [Bernard Etkin and Lloyd Duff Reid].[1996]. [Dynamics of Flight stability and

control] 3rd edition. [ 170-180]

3. [Bernard Etkin and Lloyd Duff Reid].[1996]. [Dynamics of Flight stability and

control] 3rd edition. [ 185-188]

4. Korn, Granino A.; Korn, Theresa M. (2000), "Mathematical Handbook for Scientists

and Engineers: Definitions, Theorems, and Formulas for Reference and

Review", New York: McGraw-Hill (1152 p., Dover Publications, 2 Revised edition),

5. http://www.mathworks.com/help/matlab/

6. ( Federal Aviation Administration, 2008) Aerodynamics of Flight.

http://www.faa.gov/regulations_policies/handbooks_manuals/aviation/pilot_hand

book/media/PHAK%20-%20Chapter%2004.pdf