-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrim_input.m
More file actions
195 lines (138 loc) · 6.75 KB
/
Copy pathtrim_input.m
File metadata and controls
195 lines (138 loc) · 6.75 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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
%% Search for a specified operating point for the model - ACFT.
%
% This MATLAB script is the command line equivalent of the trim model
% tab in linear analysis tool with current specifications and options.
% It produces the exact same operating points as hitting the Trim button.
% MATLAB(R) file generated by MATLAB(R) 24.2 and Simulink Control Design (TM) 24.2.
%
% Generated on: 10-Oct-2024 13:58:49
%% INPUT DATA
mass = 15000;
cg = 0.40;
Alt_ft = 25000;
KCas_kt = 200;
Gamma_deg = 0;
Phi_deg = 0;
Throttle = -1; % if throtle is -1, then will float throttle
%% Specify the model name
model = 'ACFT';
%% Create the operating point specification object.
opspec = operspec(model);
%% Set the constraints on the states in the model.
% - The defaults for all states are Known = false, SteadyState = true,
% Min = -Inf, Max = Inf, dxMin = -Inf, and dxMax = Inf.
% State (1) - ACFT/EquationsMotions/BodyRates/p_radps
% - Default model initial conditions are used to initialize optimization.
% State (2) - ACFT/EquationsMotions/BodyRates/q_radps
% - Default model initial conditions are used to initialize optimization.
% State (3) - ACFT/EquationsMotions/BodyRates/r_radps
% - Default model initial conditions are used to initialize optimization.
% State (4) - ACFT/EquationsMotions/BodyVelocities/u_mps
% - Default model initial conditions are used to initialize optimization.
% State (5) - ACFT/EquationsMotions/BodyVelocities/v_mps
% - Default model initial conditions are used to initialize optimization.
% State (6) - ACFT/EquationsMotions/BodyVelocities/w_mps
% - Default model initial conditions are used to initialize optimization.
% State (7) - ACFT/EquationsMotions/InertialData/XI_m
% - Default model initial conditions are used to initialize optimization.
opspec.States(7).SteadyState = false;
% State (8) - ACFT/EquationsMotions/InertialData/YI_m
% - Default model initial conditions are used to initialize optimization.
opspec.States(8).SteadyState = false;
% State (9) - ACFT/EquationsMotions/InertialData/ZI_m
% - Default model initial conditions are used to initialize optimization.
opspec.States(9).SteadyState = false;
% State (10) - ACFT/EquationsMotions/LBE_EulerAngles_rad/PHI_rad
% - Default model initial conditions are used to initialize optimization.
% State (11) - ACFT/EquationsMotions/LBE_EulerAngles_rad/PSI_rad
% - Default model initial conditions are used to initialize optimization.
% State (12) - ACFT/EquationsMotions/LBE_EulerAngles_rad/THETA_rad
% - Default model initial conditions are used to initialize optimization.
%% Set the constraints on the inputs in the model.
% - The defaults for all inputs are Known = false, Min = -Inf, and
% Max = Inf.
% Input (1) - ACFT/Mass_kg
% - Default model initial conditions are used to initialize optimization.
opspec.Inputs(1).u = mass;
opspec.Inputs(1).Known = true;
% Input (2) - ACFT/Elevator_deg
% - Default model initial conditions are used to initialize optimization.
% Input (3) - ACFT/CG_mac
% - Default model initial conditions are used to initialize optimization.
opspec.Inputs(3).Known = true;
% Input (4) - ACFT/Rudder_deg
% - Default model initial conditions are used to initialize optimization.
% Input (5) - ACFT/Wind_x
% - Default model initial conditions are used to initialize optimization.
opspec.Inputs(5).Known = true;
% Input (6) - ACFT/Wind_z
% - Default model initial conditions are used to initialize optimization.
opspec.Inputs(6).Known = true;
% Input (7) - ACFT/Wind_y
% - Default model initial conditions are used to initialize optimization.
opspec.Inputs(7).Known = true;
% Input (8) - ACFT/Aileron_deg
% - Default model initial conditions are used to initialize optimization.
% Input (9) - ACFT/Throttle
% - Default model initial conditions are used to initialize optimization.
%% Set the constraints on the outputs in the model.
% - The defaults for all outputs are Known = false, Min = -Inf, and
% Max = Inf.
% Output (2) - ACFT/KCas_kt
opspec.Outputs(2).y = KCas_kt;
opspec.Outputs(2).Known = true;
% Output (1) - ACFT/Alpha_deg
% - Default model initial conditions are used to initialize optimization.
% Output (3) - ACFT/Alpha_radps
% - Default model initial conditions are used to initialize optimization.
% Output (4) - ACFT/Beta_deg
% - Default model initial conditions are used to initialize optimization.
opspec.Outputs(4).Known = true;
% Output (5) - ACFT/Tas_kt
% - Default model initial conditions are used to initialize optimization.
% Output (6) - ACFT/Mach
% - Default model initial conditions are used to initialize optimization.
% Output (7) - ACFT/nx
% - Default model initial conditions are used to initialize optimization.
% Output (8) - ACFT/ny
% - Default model initial conditions are used to initialize optimization.
% Output (9) - ACFT/nz
% - Default model initial conditions are used to initialize optimization.
% Output (10) - ACFT/u_mps
% - Default model initial conditions are used to initialize optimization.
% Output (11) - ACFT/v_mps
% - Default model initial conditions are used to initialize optimization.
% Output (12) - ACFT/w_mps
% - Default model initial conditions are used to initialize optimization.
% Output (13) - ACFT/Track_deg
% - Default model initial conditions are used to initialize optimization.
% Output (14) - ACFT/Gamma_deg
% - Default model initial conditions are used to initialize optimization.
opspec.Outputs(14).Known = true;
% Output (15) - ACFT/Gspeed_kt
% - Default model initial conditions are used to initialize optimization.
% Output (16) - ACFT/x_m
% - Default model initial conditions are used to initialize optimization.
% Output (17) - ACFT/y_m
% - Default model initial conditions are used to initialize optimization.
% Output (18) - ACFT/PressAlt_ft
opspec.Outputs(18).y = Alt_ft;
opspec.Outputs(18).Known = true;
% Output (19) - ACFT/phi_deg
% - Default model initial conditions are used to initialize optimization.
% Output (20) - ACFT/theta_deg
% - Default model initial conditions are used to initialize optimization.
% Output (21) - ACFT/psi_deg
% - Default model initial conditions are used to initialize optimization.
% Output (22) - ACFT/p_degps
% - Default model initial conditions are used to initialize optimization.
% Output (23) - ACFT/q_degps
% - Default model initial conditions are used to initialize optimization.
% Output (24) - ACFT/r_degps
% - Default model initial conditions are used to initialize optimization.
% Output (25) - ACFT/Thrust_N
% - Default model initial conditions are used to initialize optimization.
%% Create the options
opt = findopOptions('DisplayReport','iter');
%% Perform the operating point search.
[op,opreport] = findop(model,opspec,opt);