-
Notifications
You must be signed in to change notification settings - Fork 38
/
mainComputeCoefficients.m
73 lines (62 loc) · 2.76 KB
/
mainComputeCoefficients.m
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
%
% @
% Copyright (C) 2017 Jonas Ruesch
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
% @
% The tornado installation directory.
% Must contain the aircraft geometry file and the status used below.
tornado_root_directory = 'F:\svn\dev\matlab\tornado\T135_export';
% The state:
% Velocity 12.5 m/s , ~45km/h (average velocity as measured in real flight)
% Velocity doesn't matter much for coefficient computation.
% Coefficients are largely velocity independent (tested)).
state.AS= 12.5; %Airspeed m/s
state.alpha= 0.0; %Angle of attack, radians
state.betha= 0; %Angle of sideslip, radians
state.P= 0; %Rollrate, rad/s
state.Q= 0; %pitchrate, rad/s
state.R= 0; %yawrate, rad/s
state.adot= 0; %Alpha time derivative rad/s
state.bdot= 0; %Betha time derivative rad/s
state.ALT= 0; %Altitude, m
state.rho= 1.225; %Desity, kg/m^3
state.pgcorr= 0; %Apply prandtl glauert compressibility correction
% The ExperimentalCarrier geometry.
aircraft_geometry_name = 'ExperimentalCarrier';
% Center of gravity
centerOfGravity = 0.092; % Tornado x-axis extends aft (!).
% The sweep ranges and sampling resolution for Simulink modelling
alphaStart = -10;
alphaEnd = 20;
numAlphas = 31;
betaStart = -10;
betaEnd = 10;
numBetas = 21;
% % Quick Test
% alphaStart = -10;
% alphaEnd = 20;
% numAlphas = 2;
% betaStart = -10;
% betaEnd = 10;
% numBetas = 2;
% Coefficient computation
[alpha, beta, CX, CY, CZ, Cl, Cm, Cn, CX_d, CY_d, CZ_d, Cl_d, Cm_d, Cn_d, ...
CX_P, CY_P, CZ_P, Cl_P, Cm_P, Cn_P, CX_Q, CY_Q, CZ_Q, Cl_Q, Cm_Q, Cn_Q, CX_R, CY_R, CZ_R, Cl_R, Cm_R, Cn_R]=computeAerodynamicCoefficients(...
aircraft_geometry_name, state, tornado_root_directory, alphaStart, ...
alphaEnd, numAlphas, betaStart, betaEnd, numBetas, centerOfGravity);
plotCoefficients(alpha, beta, CX, CY, CZ, Cl, Cm, Cn, CX_d, CY_d, CZ_d, Cl_d, Cm_d, Cn_d, ...
CX_P, CY_P, CZ_P, Cl_P, Cm_P, Cn_P, CX_Q, CY_Q, CZ_Q, Cl_Q, Cm_Q, Cn_Q, CX_R, CY_R, CZ_R, Cl_R, Cm_R, Cn_R);
plotAircraftGeometry(aircraft_geometry_name, state, tornado_root_directory);
save;