design and simulation of aircraft autopilot to control the pitch angle

9
UNIVERSITY OF JORDAN Department Of Mechatronics Engineering Design and Simulation of Aircraft Autopilot to Control the Pitch Angle Ehab Al Hamayel University Of Jordan Qusai Haltam University Of Jordan

Upload: ehab-al-hamayel

Post on 15-Jul-2015

855 views

Category:

Engineering


13 download

TRANSCRIPT

Page 1: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

UNIVERSITY OF JORDAN

Department Of Mechatronics Engineering

Design and Simulation of Aircraft Autopilot to

Control the Pitch Angle

Ehab Al Hamayel University Of Jordan

Qusai Haltam University Of Jordan

Page 2: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

Abstract

In this paper, we are going to design an aircraft

autopilot to control the pitch angle by apply the state-

space controller design technique. In particular, we

will attempt to place the closed-loop poles of the

system by designing a controller that calculates its

control based on the state of the system. Because the

dynamic equations covering the motion of the motion

of the aircraft are a very complicated set of six

nonlinear coupled differential equations. We will use a

linearized longitudinal model equation under certain

assumption to build the aircraft pitch controller also

we will verify the design and check the response using

MatLab&Simulink.

Keywords: pitch angle, angle of attack, state-space,

state feedback, pole placement, Observer.

1. Introduction

Flight dynamics the study of the motion of an aircraft

or missile; concerned with transient or short-term

effects relating to the stability and control of the

vehicle, rather than to calculating such performance as

altitude or velocity. The three critical flight dynamics

parameters are the angles of rotation in

three dimensions about the vehicle's center of mass,

known as roll, pitch and yaw [1]. Aircraft engineers

develop control systems for a vehicle's orientation

(attitude) about its center of mass. The control systems

include actuators, which exert forces in various

directions, and generate rotational forces

or moments about the center of gravity of the aircraft,

and thus rotate the aircraft in pitch, roll, or yaw. For

example, a pitching moment is a vertical force applied

at a distance forward or aft from the center of gravity

of the aircraft, causing the aircraft to pitch up or down.

Some fighter planes are capable of achieving a very

high angle of attach hence the pitch angle.one of the

first and best fighters capable of doing so is the

Russian Sukhoi Su-27. The unstable aerodynamically

design gives it the ability of doing a difficult and

dangerous maneuverings that can cause the majority of

Fighters to stall or even frame damage, figure.1 shows

a signature maneuvering done by the Russian su-27

pilots called “Pugachev Cobra”, The manoeuvre is

named after the Soviet test pilot Viktor Pugachev, who

first performed the maneuver publicly in 1989 at

the Paris Le Bourget air show.[2]

Such maneuver needs a capable and reliable controller

to prevent the fighter from being out of control!

in this paper we propose a state-space pitch controller

based on a linearized dynamic model (for simplicity)

under a specific assumptions for a commercial jet

aircraft.

2. System model equations

The equations governing the motion of an aircraft are a

very complicated set of six nonlinear coupled

differential equations. However, under certain

assumptions, they can be decoupled and linearized into

longitudinal and lateral equations. Aircraft pitch is

governed by the longitudinal dynamics. The basic

coordinate axes and forces acting on an aircraft are

shown in the figure given below in fig.2.

Design and Simulation of Aircraft Autopilot to Control

the Pitch Angle ehab al hamayel, qusai haltam/ department of mechatronics

engineering/ University of Jordan

Under the supervision of Dr. Mohammad Janaideh

Department of mechatronics engineering/university of jordan

20 Dec 2014

Fig.1 An Su-27 performing the Cobra manoeuvre

Fig.2 Forces acting on an aircraft

Page 3: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

We will assume that the aircraft is in steady-cruise at

constant altitude and velocity; thus, the thrust, drag,

weight and lift forces balance each other in the x-

and y-directions. We will also assume that a change in

pitch angle will not change the speed of the aircraft

under any circumstance (unrealistic but simplifies the

problem a bit). Under these assumptions, the

longitudinal equations of motion for the aircraft can be

written as follows:

For this system, the input will be the elevator

deflection angle and the output will be the pitch

angle of the aircraft.

We will plug in some numerical values in our

equations taken from the data from one of Boeing's

commercial aircraft [3].

2.1. Transfer function

To find the transfer function of the above system, we

need to take the Laplace transform of the above

modeling equations. Recall that when finding a

transfer function, zero initial conditions must be

assumed. The Laplace transform of the above

equations are shown below:

Then we obtain the following transfer function:

2.2. State space

Recognizing the fact that the modeling equations

above are already in the state-variable form, we can

rewrite them as matrices as shown below.

Since our output is pitch angle, the output equation is

the following:

3. System Analysis

3.1Open-loop response

Now let's see how the uncompensated open-loop

system performs. Specifically, we will use the

MATLAB command “step” to analyze the open-loop

step response where we have scaled the input to

represent an elevator angle input ( ) of 0.15 radians

(8.6 degrees) we will get the plot in fig.3

From the above plot, we see that the open-loop

response is unstable. Stability of a system can be

determined by examining the poles of the transfer

function. The poles can be identified using the

MATLAB command pole. The result is shown below:

p1= 0

p2= -0.3695 + 0.8857i

p2=-0.3695 - 0.8857i

As indicated above, one of the poles of the open-loop

transfer function is on the imaginary axis while the

other two poles are in the left-half of the complex s-

plane. A pole on the imaginary axis indicates that the

free response of the system will not grow unbounded,

but also will not decay to zero. Even though the free

response will not grow unbounded, a system with a

pole on the imaginary axis can grow unbounded when

given an input, even when the input is bounded. This

fact is in agreement with what we have already seen.

In this particular case, the pole at the origin behaves

Fig.3 open loop response

Page 4: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

like an integrator. Therefore, when the system is given

a step input its output continues to grow to infinity in

the same manner that an integral of a constant would

grow to infinity as the upper limit of the integral is

made large!

3.2Closed-loop response

The closed-loop transfer function for the transfer

function in (10) with the controller C(s) simply set

equal to one can be generated using the MATLAB

command feedback as shown below.

Examining the above closed-loop step response, the

addition of feedback has stabilized the system. In fact,

the steady-state error appears to be driven to zero and

there is no overshoot in the response, though the rise-

time and settle-time appear to be very high! The

character of the resulting step response is indicated by

the location of the poles and zeros of the system's

transfer function, in a similar manner to the way the

system's stability properties were. The MATLAB

commands pole and zero can be used to reveal the

poles and zeros of the closed-loop transfer function as

shown below:

poles =

-0.3255 + 1.3816i

-0.3255 - 1.3816i

-0.0881

zeros =

-0.1541

The root locus for the closed loop system is shown in

fig.5.

The above results demonstrate that the closed-loop

transfer function is third order with a zero.

4. State-Space Methods for Controller

Design

4.1 Design requirements

The chosen design criteria for our controller:

Overshoot less than 5%

Rise time less than 1.5 seconds

Settling time less than 5 seconds

Steady-state error less than 2%

We will attempt to place the closed-loop poles of the

system by designing a controller that calculates its

control based on the state of the system.

4.2 Controllability

In order to apply our state-space controller design

techniques we need to first verify an important

property, controllability. The controllability property is

necessary to guarantee that we have the authority to

drive the state of the system anywhere we like. This

corresponds to the ability to place the closed-loop

poles of the system anywhere in the complex s-plane.

For the system to be completely state controllable, the

controllability matrix is:

This matrix must have rank n. The rank of a matrix is

the number of independent rows (or columns). The

number n corresponds to the number of state variables

Fig.4 Closed-loop response

Fig.5 Root-locus of the closed-loop system

Page 5: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

of the system. Since our controllability matrix is 3x3,

the rank of the matrix is 3 so the system is

controllable.

4.3 Control design via pole placement

The schematic of a full-state feedback control system

is shown below in Fig.6 (with D = 0).

Where

K = control gain matrix

x = [α, q, θ]' = state vector

θdes = reference (r)

δ = θdes - K x = control input (u)

θ = output (y)

Referring to the state-space equations (13)and (14), we

see that substituting the state-feedback law δ = θdes- Kx

leads to (15)&(16).

Based on the above, matrix A - BK determines the

closed-loop dynamics of our system. Specifically, the

roots of the determinant of the matrix [ sI - ( A - BK ) ]

are the closed-loop poles of the system. Since the

determinant of [ sI - ( A - BK ) ] is a third-order

polynomial, there are three poles we can place and

since our system is completely state controllable, we

can place the poles anywhere we like. "pole-placement"

technique can be used to find the control gain matrix K

to place the closed-loop poles in the desired locations.

Note that this feedback law presumes that all of the

state variables in the vector x are measured, even

though θ is our only output. If this is not the case, then

an observer needs to be designed to estimate the other

state variables.

We know from the above that we can place the closed-

loop poles of the system anywhere we would like. The

question then that is left is, where should we place

them? If we have a standard first- or second-order

system, we then have relationships that directly relate

pole locations to characteristics of the step response and

can use these relations to place the poles in order to

meet our given requirements. This process becomes

more difficult if we have a higher-order system or

zeros. With a higher-order system, one approach is to

place the higher-order poles 5-10 times farther to the

left in the complex plane than the dominant poles,

thereby leading them to have negligible contribution to

the transient response. The effect of zeros is more

difficult to address using a pole-placement approach to

control. Another limitation of this pole-placement

approach is that it doesn't explicitly take into account

other factors like the amount of required control effort!

4.4 Linear quadratic regulation

We will use a technique called the Linear Quadratic

Regulator (LQR) method to generate the "best" gain

matrix K, without explicitly choosing to place the

closed-loop poles in particular locations. This type of

control technique optimally balances the system error

and the control effort based on a cost that the designer

specifies that defines the relative importance of

minimizing errors and minimizing control effort. In the

case of the regulator problem, it is assumed that the

reference is zero. Therefore, in this case the magnitude

of the error is equal to the magnitude of the state. To

use this LQR method, we need to define two

parameters: the state-cost weighted matrix (Q) and the

control weighted matrix (R). For simplicity, we will

choose the control weighted matrix equal to 1 (R=1),

and the state-cost matrix (Q) equal to pC'C. Employing

the vector C from the output equation means that we

will only consider those states in the output in defining

our cost. In this case, is the only state variable in the

output. The weighting factor (p) will be varied in order

to modify the step response. In this case, R is a scalar

since we have a single input system.

We will employ the MATLAB command lqr to find

the proper poles location, we will first let the weighting

factor (p) equal 10 then checking the system response.

>> p = 10;

Q = p*C'*C

R = 1;

[K] = lqr(A,B,Q,R)

sys_CL = ss(A-B*K, B, C, D);

Fig.6 Full state feedback control system

Page 6: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

step(0.15*sys_CL)

ylabel('pitch angle (rad)');

title('Closed-Loop Step Response: LQR');

Q =

0 0 0

0 0 0

0 0 10

K =

-0.5963 100.4036 3.1623

And the system output response can be seen in fig.7

Examination of the above demonstrates that the

response is too slow. We can tune the performance of

our system to be faster by weighting the importance of

the error more heavily than the importance of the

control effort. More specifically, this can be done by

increasing the weighting factor p. After some trial and

error, we settle on a value of p = 50. The response for

the new weighting factor p=50 is shown in fig.8

Examination of the above demonstrates that the rise

time, overshoot, and settling time are satisfactory.

However, there is a large steady-state error. One way

to correct this is by introducing a precompensator ( ̅)

to scale the overall output.

4.5 Adding Precompensator ( ̅)

Unlike other design methods, the full-state feedback

system does not compare the output to the reference;

instead, it compares all states multiplied by the control

matrix (K x) to the reference. Thus, we should not

expect the output to equal the commanded reference!

To obtain the desired output, we can scale the reference

input so that the output does equal the reference in

steady state. This can be done by introducing a

precompensator scaling factor called ̅̅̅. The basic

schematic of our state-feedback system with scaling

factor ( ̅) is shown in Fig.9.

We can easily find Nbar from the MATLAB by using

a user-defined function called “Rescale.m” see

appendix.

>> p = 50;

Q = p*C'*C

R = 1;

[K] = lqr(A,B,Q,R)

Nbar = Rescale(A,B,C,D,K)

sys_CL = ss(A-B*K, B*Nbar, C, D);

step(0.15*sys_CL)

axis([0 8 0 0.18])

ylabel('pitch angle (rad)');

title('Closed-Loop Step Response: LQR');

Q =

0 0 0

0 0 0

0 0 50

Fig.7 the system response with weighting factor p=10

Page 7: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

K =

-0.6435 169.6950 7.0711

Nbar =

7.0711

The new system response is shown in fig.10

Now the steady-state error has been eliminated and all

design requirements are satisfied.

Note that the precompensator Nbar employed above is

calculated based on the model of the plant and further

that the precompensator is located outside of the

feedback loop. Therefore, if there are errors in the

model (or unknown disturbances) the precompensator

will not correct for them and there will be steady-state

error. You may recall that the addition of integral

control may also be used to eliminate steady-state error,

even in the presence of model uncertainty and step

disturbances. The tradeoff with using integral control is

that the error must first develop before it can be

corrected for, therefore, the system may be slow to

respond. The precompensator on the other hand is able

to anticipate the steady-state offset using knowledge of

the plant model. A useful technique is to combine the

precompensator with integral control to leverage the

advantages of each approach. The system with

disturbance and its response are shown in fig.11&12

5. Observer Design

When we can't measure all the states x (often the case

in practice), we can build an observer to estimate them,

while measuring only the output y = C x. in our case the

pitch angle θ, we will add three new, estimated states to

the system. The schematic is shown in fig.13:

The observer is basically a copy of the plant; it has the

same input and almost the same differential equation.

An extra term compares the actual measured output y to

the estimated output ̂; this will cause the estimated

states ̂ to approach the values of the actual states x.

The error dynamics of the observer are given by the

poles of (A-LC).

First, we need to choose the observer gain L. Since we

want the dynamics of the observer to be much faster

Page 8: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

than the system itself, we need to place the poles at

least five times farther to the left than the dominant

poles of the system. If we want to use place, we need to

put the three observer poles at different locations.

op1 = -100;

op2 = -101;

op3 = -102;

L = place(A',C',[op1 op2 op3])';

The equations in the block diagram on fig.13 are given

for ̂ It is conventional to write the combined equations

for the system plus observer using the original state x

plus the error state: e = x - ̂. We use as state feedback u

= -K ̂. After a little bit of algebra, we arrive at the

combined state and error equations with the full-state

feedback and an observer. Equations 17 to 21

the observer with the perfect model and the system

response are shown on Fig.14 &15 respectively .

6. Conclusion

On this paper we have designed and simulated a pitch

controller for a commercial aircraft. we have obtained

the design requirements through the use of state

feedback controller, also an observer has been belt to

estimate the state variables.

6. Future Work

Analyzing and develop controllers for the nonlinear

system instead of linearizing the system at a trim

point.

Designing an autopilot that can control all the flight

parameter such as pitch, yaw, and roll.

Experimental verification and implementation of

the autopilot on working aircraft prototype.

7. References

[1] McGraw-Hill Dictionary of Scientific & Technical Terms, 6E,

Copyright © 2003 by The McGraw-Hill Companies, Inc.

[2] Mike Spick (2002). The Illustrated Directory of Fighters. St.

Paul, Minnesotta: MBI Publishing Company. p. 442. ISBN 0-7603-

1343-1. Retrieved 29 October 2011.

[3] Control Tutorials for MATLAB and Simulink. Bill Messner ,

Department of Mechanical Engineering at Carnegie Mellon

University , Dawn Tilbury of the Department of Mechanical

Engineering and Applied Mechanics at the University of Michigan,

http://ctms.engin.umich.edu/

[4] Stengel, Robert F. (2010), Aircraft Flight Dynamics (MAE 331)

course summary, retrieved November 16, 2011

[5] Anderson, John D. (2004), Introduction to Flight (5th ed.),

McGraw-Hill, ISBN 0-07-282569-3

[6] Sidi, M.J. "Spacecraft Dynamics & Control. Cambridge, 1997.

[7] Crane, David. "Air-to-Air Fighter Combat Application of

Pugachev’s Cobra Maneuver: Busting the Western Myth". Defense

Review. Retrieved 14 January 2012.

[8] Crane, David. "Air-to-Air Fighter Combat Application of

Pugachev’s Cobra Maneuver: Busting the Western Myth".

Defense Review. Retrieved 14 January 2012.

[9] Malcolm J. Abzug; E. Eugene Larrabee. Airplane stability and

control: a history of the technologies that made aviation possible.

pp. 157–161. ISBN 978-0-521-80992-4. Retrieved 23 March 2011.

Page 9: Design and Simulation of Aircraft Autopilot to Control the Pitch Angle

Appendix

Matlab codes % Ehab Al Hamayel and Qusai Haltam % Department Of Mechatronics Engineering|University Of

Jordan %File name: AirCraft_model.m % This code will generate the openloop transfer function

of the % longitudinal equations of motion for the aircraft, since

Aircraft pitch % is governed by the longitudinal dynamics %*Important note: We will assume that the aircraft is in

steady-cruise at %constant altitude and velocity; thus, the thrust, drag, %weight and lift forces balance each other in the x- and

y-directions. % We will also assume that a change in pitch angle will

not change the speed %of the aircraft under any circumstance %** values are taken from the data from one of Boeing's

commercial aircraft %*** Thanks to http://ctms.engin.umich.edu | Prof. Bill

Messner at Carnegie Mellon %And Prof. Dawn Tilbury at the University of Michigan %*********************************************************

***************** %Transfer function: s = tf('s'); pitch_angle = (1.151*s+0.1774)/(s^3+0.739*s^2+0.921*s) t = [0:0.01:20]; step(0.15*pitch_angle,t); axis([0 20 0 0.8]); ylabel('pitch angle (rad)'); title('Open-loop Step Response'); rlocus(pitch_angle) sys_CL = feedback(pitch_angle,1) step(0.15*sys_CL); ylabel('pitch angle (rad)'); title('Closed-loop Step Response'); p = 50; Q = p*C'*C R = 1; [K] = lqr(A,B,Q,R) Nbar = Rescale(A,B,C,D,K) sys_CL = ss(A-B*K, B, C, D); step(0.15*sys_CL) axis([0 8 0 0.025]) ylabel('pitch angle (rad)'); title('Closed-Loop Step Response: LQR');

% State-space representation: A = [-0.313 56.7 0; -0.0139 -0.426 0; 0 56.7 0]; B = [0.232; 0.0203; 0]; C = [0 0 1]; D = [0]; pitch_ss = ss(A,B,C,D)

User defined functions: function[Nbar]=Rescale(a,b,c,d,k) % Given the single-input linear system: % . % x = Ax + Bu % y = Cx + Du % and the feedback matrix K, % % the function rscale(sys,K) or

rscale(A,B,C,D,K) % finds the scale factor N which will % eliminate the steady-state error to a

step reference % for a continuous-time, single-input

system % with full-state feedback using the

schematic below: % % /---------\ % R + u | . | % ---> N --->() ---->| X=Ax+Bu |-->

y=Cx ---> y % -| \---------/ % | | % |<---- K <----| %

%8/21/96 Yanjie Sun of the University of

Michigan % under the supervision of Prof.

D. Tilbury %6/12/98 John Yook, Dawn Tilbury revised error(nargchk(2,5,nargin)); % --- Determine which syntax is being

used --- nargin1 = nargin; if (nargin1==2), % System form [A,B,C,D] = ssdata(a); K=b; elseif (nargin1==5), % A,B,C,D matrices A=a; B=b; C=c; D=d; K=k; else error('Input must be of the form

(sys,K) or (A,B,C,D,K)') end; % compute Nbar s = size(A,1); Z = [zeros([1,s]) 1]; N = inv([A,B;C,D])*Z'; Nx = N(1:s); Nu = N(1+s); Nbar=Nu + K*Nx;