-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainExample.m
More file actions
110 lines (101 loc) · 4.72 KB
/
mainExample.m
File metadata and controls
110 lines (101 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
% Project Nickel Squirrel
% ============== Design Spec ==============
Spec = struct( ...
'StallSpeed',117, ... % ft/s
'Range', 1.32E6, ... % ft
'Endurance', 14400, ... % sec
'Payload', 400, ... % lb
'ClimbRate', 30, ... % ft/s
'CruisingSpeed',234 ... % ft/s
);
% ============== World Constants ==============
WorldConstants = struct(...
'AirDensity',0.0019, ... % Air density [slug/ft^3]
'kinematicViscosity', 1.529e-4,... % kinematic Viscosity [ft^2/s]
'airSpecificHeatRatio', 1.4,... % airSpecificHeatRatio [Null]
'airSpecificGasConstant', 1716,... % airSpecificGasConstant [ft lb/slug oR]
'airTemperature',527.67); % airTemperature [R]
% Parameters;
W_to = 3000; %takeoff weight [lb]
% ============== build components ==============
% fuselage
L = 20.044283750055012; % fuselarge length [ft]
D = 4.5; % fuselarge deepth [ft]
fuselage = Fuselage(W_to, L, D);
% wing
span = 30.188353302222050; % chord length
cla = 6.500000000000000; % 2D cl alpha [/rad]
c_mac = -0.1; % 2D moment coefficient C_m(1/4)
s = 1.10630648766614e+02; % wing area
e = 1/(1.05+0.007 * pi * span/(s/span)); % Oswald efficiency number
taper = 0.4; % Taper Ratio
t = 0.18; % maximum thickness of wing over chord (t/c)m
stallAngle = 15/180*pi; % stall angle
xcRatio = 0.3; % chordwise location of the airfoil maximum thickness point (x/c)m [Raymer 283]
wing = Wing(W_to,cla,c_mac,s,span, t, xcRatio,taper , stallAngle,e);
% fuel system
fuelCapacity = 90; % [lb]
initFuel = 90; % [lb]
fuelSys = FuelSystem(fuelCapacity,initFuel);
% Horizontal Tail
b = 15.858803965044864; % tail span [ft]
cla = 6.2; % 2D cl alpha
s = 50; % wing area
t = 0.12; % maximum thickness of wing over chord (t/c)m
xcRatio = 0.3; % chordwise location of the airfoil maximum thickness point (x/c)m [Raymer 283]
e = 1; % Oswald efficiency number
it = 1/180*pi; % incidence angle [/rad]
tau = 0.35; % elevator area persentage
de = -0/180*pi; % initial elevator angle [rad]
max_de = 30/180*pi; % max abs of elevator angle [rad]
htail = HTail(W_to,b,cla,s, t,xcRatio, e, it,tau, de, max_de);
% Vertical Tail
s = 15; % area in ft^2
b = 5; % span in ft
t = 0.12; % maximum thickness of wing over chord (t/c)m
xcRatio = 0.3; % chordwise location of the airfoil maximum thickness point (x/c)m [Raymer 283]
vtail = VTail(W_to,s,b,t, xcRatio);
% Engine
propD = 5.3; % propeller diameter [ft]
engine = Engine(propD);
% ============== init Aircraft ==============
testUAV = AirCraft(W_to, fuselage,wing,fuelSys, htail,vtail,engine);
% Use the Following Flight Condition
testUAV.AoA = 2/180*pi;
testUAV.alt = 3300;
testUAV.v = 150;
testUAV.payloadWeight = 400; % here the weight must be the payload the UAV is going to pickup
% Use the Following Layout
% Easy-Layout
FuselageNosetoWingFrontRatio = 0.1;
TailtoFuselageFrontRatio = 0.91;
FueltoFuselageFrontRatio = 0.45;
PayloadtoFuselageFrontRatio = 0.22;
fuselageToChord = testUAV.fuselage.L/testUAV.wing.getChord;
testUAV.h_acw = 1/4;
testUAV.h_fuselage = fuselageToChord * (1/2 - FuselageNosetoWingFrontRatio) ;
testUAV.h_act = testUAV.h_fuselage + fuselageToChord * (TailtoFuselageFrontRatio - 1/2);
testUAV.h_acvt = testUAV.h_fuselage + fuselageToChord * (TailtoFuselageFrontRatio - 1/2);
testUAV.h_engine = 1/4;
testUAV.h_fuelSys = testUAV.h_fuselage + fuselageToChord * (FueltoFuselageFrontRatio - 1/2);
testUAV.h_payload = testUAV.h_fuselage + fuselageToChord * (PayloadtoFuselageFrontRatio - 1/2);
% Automatically match weigt
while abs(testUAV.W_to - testUAV.getWeight) > 5
testUAV.W_to = testUAV.getWeight;
testUAV.fuselage.W_to = testUAV.getWeight;
testUAV.wing.W_to = testUAV.getWeight;
testUAV.hTail.W_to = testUAV.getWeight;
testUAV.vTail.W_to = testUAV.getWeight;
end
% ============== test Aircraft ==============
% let aircraft cruise. this step is not necessary for test aircraft.
% this is just for getting cruising data.
[testUAV.v,testUAV.AoA,testUAV.hTail.de,testUAV.engine.throttle] = testUAV.cruise(WorldConstants, Spec);
% put aircraft into wintunnel and get test result.
result = windTunnel(testUAV,WorldConstants,Spec);
% ============== Draw Graphs ==============
% gt = GraphTool(testUAV,WorldConstants,70:300);
% gt.drawTrimVsVelocity();
% gt.drawDragVsVelocity();
% gt.drawPowerVsVelocity()
% gt.drawClVsCd();