-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGtm6dof.m
146 lines (132 loc) · 5.61 KB
/
Gtm6dof.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
classdef Gtm6dof < aerootools.EOM6
% 6-DOF equations of motion for the Generic Transport Model.
%
%% About
%
% * Author: Torbjoern Cunis
% * Email: <mailto:[email protected]>
% * Created: 2019-03-17
% * Changed: 2019-03-17
%
% This file is part of GTMpw -- Piecewise polynomial model of the GTM
% published under the GNU General Public License v3.
%
%% Variables, constants, and their units
%
% * |alpha| : angle of attack, rad
% * |gamma| : flight-path inclination angle, rad
% * |gammaAir| : air-path inclination angle rad
% * |gammadot| : change in inclination angle, rad/s
% * |zeta| : rudder deflection, rad
% * |eta| : elevator deflection, rad
% * |Theta| : pitch angle, rad
% * |mu| : air-path bank angle, rad
% * |xi| : aileron deflection, rad
% * |rho| : air density, kg/m^3
% * |Phi| : roll angle, rad
% * |chi| : air-path/flight-path azimuth, rad
% * |Psi| : heading angle, rad
% * |b| : reference aerodynamic span, m
% * |c| : reference (mean) aerodynamic coord, m
% * |Cl| : aerodynamic coefficient moment body x-axis, -
% * |Cm| : aerodynamic coefficient moment body y-axis, -
% * |Cn| : aerodynamic coefficient moment body z-axis, -
% * |Cx| : aerodynamic coefficient force body x-axis, -
% * |Cy| : aerodynamic coefficient force body y-axis, -
% * |Cz| : aerodynamic coefficient force body z-axis, -
% * |F| : thrust, N
% * |g| : gravitational constant, m/s^2
% * |I*| : inertia *-axis, kg-m^2
% * |L| : roll moment, body x-axis, N-m
% * |m| : aircraft mass, kg
% * |M| : pitch moment, body y-axis, N-m
% * |N| : yaw moment, body z-axis, N-m
% * |p| : roll rate, body x-axis, rad/s
% * |q| : pitch rate, body y-axis, rad/s
% * |r| : yaw rate, body z-axis, rad/s
% * |*hat| : normalized * rate, rad
% * |S| : reference wing aera, m^2
% * |VA| : airspeed, VA = |uA vA wA| m/s
% * |VK| : path speed, VK = |uK vK wK| m/s
% * |VW| : wind speed, m/s
% * |Vdot| : change in speed, m/s^2
% * |x_cg| : center of gravity, body x-axis, m
% * |x_cgref| : reference center of gravity, body x-axis, m
% * |z_cg| : center of gravity, body z-axis, m
% * |z_cgref| : reference center of gravity, body y-axis, m
% * |Xf| : force body x-axis, N
% * |Yf| : force body y-axis, N
% * |Zf| : force body z-axis, N
%
%% See
%
% See also aerootools.EOM6
%%
properties (Access=protected)
AC;
AM;
end
methods
function obj = Gtm6dof(am, ac, g)
% Instance of 6-DOF equations of motion
% with aircraft model |AM|, aerodynamic coefficients |AC|, and
% optional gravitational constant |g|.
obj.AM = am;
if nargin > 1
obj.AC = ac;
obj.Ac.g = g;
else
[obj.AC, obj.AC.g] = gtm2si;
end
end
end
methods (Static)
function par = mu(varargin)
% Parameters mu = [eps]
%
% Overriding EOM6.mu
par = eom.pkg.GtmParameters(varargin{:});
end
end
methods (Access=protected)
function CR = Cr(obj, X, U, mu, varargin)
% aerodynamic force coefficients
%
% implementing EOM6.Cr
what = obj.omegahat(X,U,mu,varargin{:});
CR = [
obj.AM.Cx(alpha(X),beta(X),xi(U),eta(U),zeta(U),what(1),what(2),what(3),eps(mu));
obj.AM.Cy(alpha(X),beta(X),xi(U),eta(U),zeta(U),what(1),what(2),what(3),eps(mu));
obj.AM.Cz(alpha(X),beta(X),xi(U),eta(U),zeta(U),what(1),what(2),what(3),eps(mu));
];
end
function CQ = Cq(obj, X, U, mu, varargin)
% aerodynamic moment coefficients
%
% implementing EOM.Cq
what = obj.omegahat(X,U,mu,varargin{:});
CQ = [
obj.AM.Cl(alpha(X),beta(X),xi(U),eta(U),zeta(U),what(1),what(2),what(3),eps(mu));
obj.AM.Cm(alpha(X),beta(X),xi(U),eta(U),zeta(U),what(1),what(2),what(3),eps(mu));
obj.AM.Cn(alpha(X),beta(X),xi(U),eta(U),zeta(U),what(1),what(2),what(3),eps(mu));
];
end
function QF = Qf(obj, varargin)
% aerodynamic/thrust moments body axis system
% taking into account cg-cgref offset
% and vertical engine displacement
cgref = obj.AC.cgref;
cg = obj.AC.cg;
l_t = obj.AC.l_t;
% aerodynamic moments body axes
QF0 = [email protected](varargin{:});
% aerodynamic forces body axes
RF = obj.RAf(varargin{:});
% thrust force (along body x-axis)
F = obj.thrust(varargin{:});
QF = QF0 ...
+ cross(RF, cg-cgref) ...
+ [0; l_t*F; 0];
end
end
end