You are on page 1of 13

Aircraft Design Lab Problem 1

function [T p rho a]=Stdatm(h)


h1=11; h2=20; h3=32; a0=-6.5e-3; a2=1e-3; g=9.80665; mol=28.9644;
R0=8.31432; R=R0/mol*1e3;
T0=288.15; p0=1.01325e5; rho0=1.2250; T1=T0+a0*h1*1e3;
p1=p0*(T1/T0)^(-g/a0/R); rho1=rho0*(T1/T0)^(-g/a0/R-1); T2=T1;
p2=p1*exp(-g/R/T2*(h2-h1)*1e3); rho2=rho1*exp(-g/R/T2*(h2-h1)*1e3);
if h <= h1
disp('Troposphere');
T=T0+a0*h*1e3;
p=p0*(T/T0)^(-g/a0/R);
rho=rho0*(T/T0)^(-g/a0/R-1);
a = sqrt(1.4*R.*T);
elseif h <= h2
disp('Tropopause');
T=T1;
p=p1*exp(-g/R/T*(h-h1)*1e3);
rho=rho1*exp(-g/R/T*(h-h1)*1e3);
a = sqrt(1.4*R.*T);
elseif h <= h3
disp('Stratosphere');
T=T2+a2*(h-h2)*1e3;
p=p2*(T/T2)^(-g/a2/R);
rho=rho2*(T/T2)^(-g/a2/R-1);
a = sqrt(1.4*R.*T);
else
disp('Error: the altitute should be less then 32 km');
end

Solution:

clc
clear all
close all
h=0:0.2:32;
for k=1:size(h,2);
[T(k) p(k) rho(k) a(k)]=Stdatm(h(k));
end
h_alt = h';
T_alt = T';
p_alt = p';
d_alt = rho';
a_alt = a';

%% print the results

% header1 = 'H (m)';


% header2 = 'Temp(k)';
% header3 = 'Press';
% header4 = 'density';
% header5 = 'speed';
fid=fopen('atmISA.txt','w');
% fprintf(fid, [ header1 ' ' header2 ' ' header3 ' ' header4 ' ' header5
'\n']);
fprintf(fid, '%1.2f %1.2f %1.0f %1.4f %1.2f \n', [h_alt T_alt p_alt d_alt
a_alt]');
fclose(fid);

%% plot the results

figure;
plot(T-273.15,h);
xlabel('Temperature ({o}C)');
ylabel('Altitude (km)');
grid on;
figure;
plot(p,h);
xlabel('Pressure (N/m2)');
ylabel('Altitude (km)');
grid on;
figure; plot(rho,h);
xlabel('Density (kg/m3)');
ylabel('Altitude (km)');
grid on;
figure; plot(a,h);
xlabel('Speed of sound (m/s2)');
ylabel('Altitude (km)');
grid on;

In other unit:

function [T p rho]=StdatmUS(h)
%US Standard Atmosphere in US units
%Input : h altitute (ft)
%Output : T temperature (R), p pressure (lbf/ft2), rho density (slug/ft3)
[T p rho]=Stdatm(h*0.3048/1000);
T=1.8*T;
p=p*0.0208854342331501;
rho=rho*0.00194032033197972;

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Aircraft Design Lab Problem 2

function fcns = eqns(z)


x=z(1);
y=z(2);
fcns(1) = ((0.677.*y)-(x.*y)-198360);
fcns(2) = (-7.754.*1e-8).*y+0.576-x;
end

Solution:

close all; clc; clear all;


x0=[0.3 1000000];
options = optimset('display','off')
[result]=fsolve(@eqns,x0,options);
Empty_weight_ratio = result(:,1);
Takeoff_weight = result(:,2);
fprintf('The empty weight ratio is estimated to be %1.4f
lbs.\n',Empty_weight_ratio);
fprintf('The takeoff weight is estimated to be %5.2f lbs.\n',Takeoff_weight);

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function y=func(x)
y= -7.754*1e-8*(x.^2)-0.101*x+198360;
end

Solution:

close all
clc
clear all
solution= fzero(@(x)func(x),[1000000])
fprintf('The takeoff weight is estimated to be %5.2f lbs.\n',solution);

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

% Trial & error estimation


%% Code
clc;
clear all;
Payload=198360; %Calculated Payload
a=-7.754*10^(-8);
b=0.576;
WTO=1000000; %Assumed takeoff weight
ER=1; %error variable initialization
while (ER>0.00003)
WebWTO=(a*WTO+b);
WTOn=Payload/(0.677-(WebWTO)); %New calculated Takeoff weight
ER=abs((WTO-WTOn)/WTO); %Error Calculation
WTO=ER*WTO; %New guess value by multiplying it with error factor for fast
convergence
end

%Web/WTO means We by Wto , b refers to by.


%% RESULTS DISPLAY
fprintf('The takeoff weight is estimated to be %5.2f lbs.\n', WTOn);

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Aircraft Design Lab Problem 4

V=linspace(150,1000,500);
W=73000;
S=950;
CD0=0.015;
K=0.05;
rho=1.7553e-3;
T=1/2*rho*V.^2*S*CD0+2*K*W^2/rho./V.^2/S
plot(V,T);
xlabel('Velocity (ft/s)');
ylabel('Thrust required (lb)');
grid on;

roots([1/2*rho*S*CD0 0 -Tsmax*(rho/rhos)^m 0 2*K*W^2/rho/S])

function error=eqnFC(h)
%Input: altitude (ft)
W=73000;
CD0=0.015;
K=0.05;
Tsmax=12500;
m=0.6;
[Ts ps rhos]=StdatmUS(0);
[Th ph rhoh]=StdatmUS(h);
error=2*W*sqrt(K*CD0)-Tsmax*(rhoh/rhos)^m;

Solution:

hmax=fsolve(@eqnFC,10000)

function [Vmax VminTC Vstall]=SLF(h);


%Input: altitude h (ft)
%Output: Maximum air speed Vmax (ft/s)
% Minimum air speed by the thrust constraint VminTC (ft/s)
% Stall speed Vstall (ft/s);
W=73000;
S=950;
CD0=0.015;
K=0.05;
Tsmax=12500;
m=0.6;
CLmax=2.8;
[Ts ps rhos]=StdatmUS(0);
[T p rho]=StdatmUS(h);
tmp=sort(roots([1/2*rho*S*CD0 0 -Tsmax*(rho/rhos)^m 0 2*K*W^2/rho/S]));
Vmax=tmp(4);
VminTC=tmp(3);
Vstall=sqrt(2*W/rho/S/CLmax);

Solution:

h=linspace(0,50361,500);
for k=1:size(h,2)
[Vmax(k) VminTC(k) Vstall(k)]=SLF(h(k));
end
Vmin=max(VminTC,Vstall);
area([Vmin Vmax(end:-1:1)],[h h(end:-1:1)],...
'FaceColor',[0.8 1 1],'LineStyle','none');
hold on;
plot(Vmax,h,VminTC,h,Vstall,h);
grid on;
xlim([0 1200]);
xlabel('Velocity (ft/s)');
ylabel('Altitude (ft)');

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Aircraft Design Lab Problem 5

% Function to estimate the drag of an aircraft


% with quadratic drag polar

function [drag,LD]=dragf(mach,rho,a,mass)

global A e S g neng tsfc

rhos = 1.225;
vtas = mach .* a;
q = 0.5 * rho* vtas.^2;

% Estimates the cruise CL (lift coefficient) at half point of the cruise


profile

cl = 2 * g* mass ./ (rho * vtas.^2 * S);

% Estimates drag coefficient

Cdoct = [0.019 0.019 0.0190 0.0190 0.0200 0.021 0.0240 0.0340


0.0515];
macht = [0.0 0.70 0.76 0.82 0.84 0.86 0.88 0.90 0.95];
kf = 1/(pi * A * e);

cdo = interp1(macht,Cdoct,mach); % zero lift drag


coefficient
cd = cdo + kf * cl.^2; % Total drag coefficient

% Estimate the total vehicle drag

LD = cl ./ cd; % Lift to drag ratio


drag = S * q .* cd

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

mach = 0:.05:0.9;
alt = [0 5000 10000 15000 20000 25000 30000 35000 40000 45000];

[m,h] = meshgrid(mach,alt);

% Do a simple polynomial fit to the function TSFC vs mach number

k = polyfit(mach,tsfc(1,:),1);

tsfc_predicted = polyval(k,mach);
% Compare actual vs regressed data

plot(mach,tsfc(1,:),'o',mach,tsfc_predicted)
xlabel('Mach Number')
ylabel('TSFC')
grid

pause

surf(m,h,tsfc)
xlabel('Mach Number')
ylabel('Altitude (m)')
zlabel('TSFC (lb/hr lbf)')
title('Engine Data')

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Aircraft Design Lab Problem 6

Aircraft Data: (save this as jet_aircraft in


MATLAB)
% Aircraft file to model a 50 passenger regional jet aircraft
%
global A e S neng tsfc macht Cdoct
global mass thrust_table mach_table lapse_rate_factor
global Vclimb Vdescent altc g tcRatio sweepAngle

A = 8.6; % aspect ratio


e = 0.84; % Oswald's efficiency factor
S = 58.4; % wing area in m^2
tcRatio = 0.10; % thickness to chord ratio
(dimansionless)
sweepAngle = 10; % sweep angle of the wing (degrees)
g = 9.81; % gravity constant
neng = 2; % number of engines
tsfc = 0.000195; % TSFC in N/s / Newton
mass =24000; % aircraft mass in kilograms

% Drag characterictics - CDO function (zero lift


% drag function)

Cdoct = [0.018 0.018 0.019 0.022 0.037];


macht = [0.0 0.70 0.73 0.79 0.83];

% Thrust parameters for regional jet aircraft (at sea level) - per engine

thrust_table = [41800 30300 27600]; % Thrust limits (sea level in


Newtons)
mach_table = [0.0 0.6 0.9]; % mach number limits to
bound thrust
lapse_rate_factor = 1.10; % thrust lapse rate
factor - corrects thrust for altitude changes

% Computes the aircraft climb and descent profiles given altitude (VCAS
given) - typical for
% a regional jet

Vclimb = [230 230 230 230 230]; % knots indicated (near


optiimum for ROC)
%Vclimb = [180 195 222 230 230]; % knots indicated - new BADA
climb profile
Vdescent = [200 220 240 240 210]; % knots indicated
altc = [ 0 1000 3000 6000 14000]; % meters

Function to Estimate atmospheric data:


function [T p rho] = Stdatm(h)
h1=11000; h2=20000; h3=32000; a0=-6.5e-3; a2=1e-3; g=9.80665; mol=28.9644;
R0=8.31432; R=R0/mol*1e3;
T0=288.15; p0=1.01325e5; rho0=1.2250; T1=T0+a0*h1;
p1=p0*(T1/T0)^(-g/a0/R); rho1=rho0*(T1/T0)^(-g/a0/R-1); T2=T1;
p2=p1*exp(-g/R/T2*(h2-h1)); rho2=rho1*exp(-g/R/T2*(h2-h1));
if h <= h1
T=T0+a0*h;
p=p0*(T/T0)^(-g/a0/R);
rho=rho0*(T/T0)^(-g/a0/R-1);
elseif h <= h2
T=T1;
p=p1*exp(-g/R/T*(h-h1));
rho=rho1*exp(-g/R/T*(h-h1));
elseif h <= h3
T=T2+a2*(h-h2);
p=p2*(T/T2)^(-g/a2/R);
rho=rho2*(T/T2)^(-g/a2/R-1);
else
disp('Error: the altitute should be less then 32000 m');
end

Function to Estimate density altitude:

% Function to estimate: aircraft true mach number, air density, speed of


sound, temperature, and density altitude

% Inputs:

% alt = altitude (m)


% ias = indicated airspeed (knots)
% deltaTemp = degrees from ISA condition (deg. Celsius)

% Outputs:
% mtrue = true mach number (dim)
% a_alt = speed of sound at altitude (m/s)
% temp = air temperature degrees (deg. Kelvin)
% dAlt = density altitude (meters)

function [mtrue,a_alt,density,temp,dAlt] = densityAltitude(deltaTemp,alt,ias)

h = alt; % Input altitude

rho_zero = 1.225; % density at sea level

[T p rho]=Stdatm(h); % computes standard


atmosphere data
temp = T + deltaTemp; % gets temperature + ISA
press = p; % gets pressure

% Compute the pressure ratio (delta)

delta = press./101325; % pressure ratio (dim)


theta = temp/288.16; % temperature ratio (dim)
sigma = delta./theta; % density ratio (dim)
density = sigma * rho_zero; % density for density altitude calculation
(kg/m-m-m)

% Calculate the density altitude (meters)

dAlt = (44.3308-4.94654.*p.^0.190263)*1000;

% Compute mach number and speed of sound

mtrue = sqrt(5 * ((rho_zero./density .*((1 + 0.2 .* (ias./661.5).^2)...


.^3.5 -1) + 1).^0.286 -1));

a_alt = sqrt(1.4*287*T); % gets speed of sound

Function to Estimate drag and coefficient:


% Function to estimate the drag of an aircraft with quadratic (parabolic)
drag polar

% Outputs:

% drag = total aircraft drag (N)


% LD = lift to drag ratio (dimensionless)
% lift_coefficient = lift coefficient (dimensionless)
% drag_coefficient = total drag coefficient (dimensionless)

% Inputs:

% mach = true mach number (dimensionless)


% rho = air density (kg/cu. meter)
% a = speed of sound (m/s-s)
% mass = aircraft mass (kg)
% macht = table of mach numbers for Cdo computation (dim)
% Cdoct = table of values of zero lift drag coefficient - Cdo
(dim)
% phi = bank angle (radians)

function
[drag,LD,lift_coefficient,drag_coefficient]=drag_03(mach,rho,a,mass,macht,Cdo
ct,phi)

global A e S g % aspect ratio, wing efficiency factor, wing area and


gravity constant

% start computations
rhos = 1.225; % value of density at sea level conditions (kg/cu.m.)
vtas = mach .* a; % true airspeed (m/s)
q = 0.5 * rho .* vtas.^2; % dynamic pressure (N/sq. meter)

% Estimates the cruise CL (lift coefficient) from basic lift equation

lift_coefficient = g*mass ./ (q .* S .* cos(phi));

% Estimates drag coefficient (first interpolate to get Cdo, then find


% total drag coefficient)

cdo = interp1(macht,Cdoct,mach); % zero lift drag coefficient (dim)


drag_coefficient = cdo + lift_coefficient.^2 ./ (pi.* A.*e);
% total drag coefficient (dim)

% Estimate the total vehicle drag

LD = lift_coefficient ./ drag_coefficient ; % Lift to drag ratio (dim)


drag = S.*q.* drag_coefficient ; % total drag

Function to Estimate thrust:


% Funtion to estimate the thrust available for a subsonic aircraft
%Thrust is a functon of speed and also a function of air density (or
altitude)

% Output:
% thrust = total thrust (N) accounting for installation

% Inputs:
% true_mach = true mach number (dimensionless)
% density = air density (kg/cu. meter)
% mach_table = table of mach numbers for thrust competition
% ttable = table with thrust values (N)
% lapse_rate = thrust lapse rate with altitude (dim)

function [thrust] =
thrust_calculation(ttable,mach_table,lapse_rate,true_mach,density)
global neng rhos
global mass thrust_table mach_table lapse_rate_factor

rhos = 1.225; % density at sea level

installation_losses_factor = 1.0; % factor to account for installation


losses and conversion to maximum
% continuous climb
rating thrust
%true_mach
tmach = neng * interp1 (mach_table, ttable, true_mach) .*
installation_losses_factor;
thrust = tmach .* (density ./ rhos) .^ lapse_rate;

Function to perform climb analysis:


function yprime = fclimb_06(t,y)

global g tsfc macht Cdoct thrust_table mach_table lapse_rate_factor


global Vclimb altc deltaTemp rhos

V = interp1 (altc,Vclimb,y(1)) ; % speed schedule - speed is


calibrated airspeed (CAS) or indicated airspeed (IAS)

% Computes standard atmosphere values


% Speed of sound in m/s at different cruise altitudes in meters

% [mtrue,a,rho,temp,dAlt] = densityAltitudeoffISA(deltaTemp,y(1),V)

[mtrue,a,rho,temp,dAlt] = densityAltitude(deltaTemp,y(1),V);

vtas = mtrue * a; % true airspeed (m/s)


q = 0.5 * rho * vtas^2; % dynamic pressure (N)
phi = 0.0; % bank angle (radians)

% Compute drag and L/D ratio

[drag,LD,cl,cd]=drag_03(mtrue,rho,a,y(2)/g,macht,Cdoct,phi);

% Estimates the thrust during climb

[thrust] =
thrust_calculation(thrust_table,mach_table,lapse_rate_factor,mtrue,rho);

% Define the rate equations (3 rate equations for 3 state variables)


% y(1) - Aircraft altitude (m)
% y(2) - Aircraft weight (N)
% y(3) - Distance traveled along the path (m)
% y(4) - Distance traveled wrt to ground (m)

yprime(1) = vtas * (thrust - drag) / (y(2)) ; % Rate of climb (m/s)


yprime(2) = - tsfc * thrust; % Mass flow rate
(N/s)
yprime(3) = vtas ; % Distance
traveled along the flight path (m)

% Calculation of flight path angle (gamma)

flt_path_angle = asin(yprime(1)/ vtas); % radians

% Calculate distance traveled across horizontal distance

yprime(4) = vtas * cos(flt_path_angle); % distance traveled along


horizontal (meters)

yprime = yprime';

Solution to Climb Analysis:


% Outputs:
% An aircraft state vector y with the following elements:

% y(1) - aircraft altitude (m)


% y(2) - aircraft weight (N)
% y(3) - distance traveled along the flight path (m)
% y(4) - distance traveled in the horizontal plane (m)

% Define global variables (to be shared across other functions and routines)

clear all

global g mass rhos hcruise deltaTemp

warning('off')

% regionalJet
jet_aircraft

h_airport = 0; % airport altitude (m) - departing


field elevation
rhos = 1.225; % sea level density (kg/m-m-m)
deltaTemp = 0; % ISA + deltaTemp conditions for
analysis (deg. Kelvin)

Mass_init = mass*g; % Initial aircraft weight (Newtons)

% Define Initial Conditions of the Problem


%
% Four state variables comprise this problem as explained in class
%
% y(1) - aircraft altitude (m)
% y(2) - aircraft weight (N)
% y(3) - distance traveled along the flight path (m)
% y(4) - distance traveled in the horizontal plane (m)

yN = [h_airport Mass_init 0 0]; % Vector of initial values of state


variables

to = 0; % to is the initial time to solve this equation (s)


tf = 3600.0; % tf is the final time (s)
Ttime = [to tf]; % Simulation span time

% Invoke the ordinary differential equation solver (stiff ODE)


%
% This part of the code integrates numerically the equations of motion of the
aircraft in climb and derives an array variable
% y that contains three state variables for altitude, weight and distance
traveled by the aircraft in climb

options = odeset('RelTol',1e-4); % to control


the tolerance of the ODE solver
[t,y] = ode15s(@fclimb_06,Ttime,yN,options); % calls te ODE solver
(for stiff ODEs)

% This ends the climb analysis procedure

% Plot the results of the numerical integration procedure

k_km2nm = 1/1.852; % convert km to nm


k_m2FL = 3.28/100; % converts meters to FL (or feet x 100)

% Calculate the rate of climb as the gradient of y(1) as a function of time


% (t)

roc=gradient(y(:,1),t); % rate of climb (meters/second)

figure
plot(y(:,1),roc*60,'o-b') % plots altitude vs rate of climb
ylabel('Rate of Climb (meters/min)')
xlabel('Altitude (meters)')
grid

% More plots of state variables

figure
plot(y(:,4)/1000*k_km2nm,y(:,1)*k_m2FL,'o-b') % plots distance (nm)
vs altitude (100 x feet)
xlabel('Distance (nm)')
ylabel('Altitude (feet x 100)')
grid

figure
plot(y(:,4)/1000,y(:,1),'o-') %
plots distance (km) vs altitude (m)
xlabel('Distance (km.)')
ylabel('Altitude (m.)')
grid

figure
plot(t,y(:,1),'o-r')
% plots altitude (m) vs time (seconds)
xlabel('Time (s.)')
ylabel('Altitude (m.)')
grid

figure
plot(t,y(:,4)/1000,'o-') %
plots a time-space diagram
xlabel('Time (s.)')
ylabel('Distance (km.)')
grid

% Plot distance vs. Fuel Consumed

figure
plot(y(:,4)/1000,y(:,2),'o-')
% plots distance (km) vs weight (N)
xlabel('Distance (km)')
ylabel('Aircraft Weight (N)')
grid

You might also like