-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClassIIEstimates.py
424 lines (295 loc) · 9 KB
/
ClassIIEstimates.py
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
'''
Wing Weight
-pg 70 Roskam
Section 5.1.4.1 (For USAF Fighter and Attack AC)
'''
from astropy import units as u
from astropy.units import imperial as ui
import math
from helpers import dyn_pres
from CSV_Handler import *
estimates = {}
class Estimate:
def __init__(self, name, weight):
self.name = name
self.weight = weight
estimates[self.name] = self.weight
weights = []
labels = []
kg_o_m3 = u.kg / u.m ** 3
slug_o_ft3 = ui.slug / ui.ft ** 3
knts = ui.nmi / u.hr
# INPUTS ####
# Kw = 1 for fixed wing and 1.175 for variable sweep
# K_w = 1.0
# Λ_LE = 35 * u.deg
# n_ult = 9
# t_o_c = 0.09 # thickness to chord ratio
#
# λ = 0.4 # wing taper ratio
#
# A = 5 # aspect ratio (using A instead of AR because Roskam uses A)
#
# S = 507 * ui.ft ** 2 # wing area
#
# W_TO = 41722 * ui.lbf # MTOW for critical mission
#
# S_h = 90 * ui.ft ** 2
# b_h = 30 * ui.ft
# t_r_h = 0.5 * ui.ft
# c_bar = 10.83 * ui.ft
# l_h = 20.12 * ui.ft
#
# z_h = 0 # As long as horizontal stablilizer is not mounted on vertical tail, equation is simplified
# M_H = 0.95 # Maximum mach number at sea level
# A_v = 5.5 # Aspect ratio of vertical tail
# S_v = 49.71 * ui.ft ** 2 # vertical tail area
# l_v = 16.2 * ui.ft # vertical tail location
# S_r = 20 * ui.ft ** 2 # rudder area
# λ_v = 0.1 # vertical tail taper ratio
# Λ_qtrchrd_v = 10 * u.deg # vertical tail quarter chord sweep angle
#
# K_inl = 1.25 # for aircraft with inlets integrated into the fuselage (pg.77)
q_bar_D = dyn_pres(0.4135 * kg_o_m3, 400 * knts) # design dive dynamic pressure in psf (pounds per sq.ft)
# l_f = 54 * ui.ft # length of fuselage (should be in ft)
# h_f = 15 * ui.ft # maximum fuselage height (should be in ft)
#
# N_inl = 2 # number of inlets
# A_inl = 5 * ui.ft ** 2 # capture area per inlet in ft^2
# l_n = 10 * ui.ft # nacelle length from inlet to compressor face
# P_2 = 30 * (ui.lbf / ui.inch ** 2) # max static pressure at engine compressor face in psi (ranges from 15 to 50 psi)
#
# W_pwr = 8920 # total weight of engines
#
# W_F = 19843 * ui.lbf # mission fuel weight including reserves
# K_fsp = 6.55 * (ui.lbf / ui.gallon) # just a constant defined in pg. 91, assuming we are using JP-4 jet fuel
W_supp = 7.91 * ((W_F / K_fsp) / 100) ** 0.854
#
# N_pil = 1 # number of pilots
# N_e = 2 # number of engines
#
# K_fcf = 138 # pg.100
#
# APU_est_factor = 0.013 # range between 0.004 to 0.013 from the equation
#
# W_pay = 14000 * ui.lbf
#
# PAINT_EST_FACTOR = 0.006 # ranges from 0.003 to 0.006, use conservative considering stealth paint might be used
# convert degrees to radians for easier calculations
Λ_qtrchrd_v = Λ_qtrchrd_v.to(u.rad)
Λ_LE = Λ_LE.to(u.rad)
# Wing Weight Function pg.70
def W_w(K_w, Λ_LE, n_ult, t_o_c, λ, A, S, W_TO):
b1 = K_w * n_ult * W_TO.value * (1 / t_o_c)
assert Λ_LE.unit == 'rad'
b2_1 = math.tan(Λ_LE.value)
b2_2 = (2 * (1 - λ)) / (A * (1 + λ))
b2 = ((b2_1 - b2_2) ** 2 + 1) * 10 ** -6
b3 = A * (1 + λ)
return 3.08 * (b1 * b2) ** 0.593 * b3 ** 0.89 * S.value ** 0.741
W_w = W_w(K_w, Λ_LE, n_ult, t_o_c, λ, A, S, W_TO)
weights.append(W_w)
labels.append('Wing')
'''
Horizontal Tail Weight
- pg.73 Roskam
(Section 5.2.2.1 GD Method)
Using this method because according to Section 5.2.2 on pg.75, I should, lmao'''
def W_h(W_TO, n_ult, S_h, b_h, t_r_h, c_bar, l_h):
curl_brackets = (W_TO * n_ult) ** 0.813 * S_h ** 0.584 * (b_h / t_r_h) ** 0.033 * (c_bar / l_h) ** 0.28
return 0.0034 * curl_brackets ** 0.915
W_h = W_h(W_TO, n_ult, S_h, b_h, t_r_h, c_bar, l_h)
weights.append(W_h.value)
labels.append('Horizontal Tail')
'''
Vertical Tail Weight
-pg 73 Roskam
(Section 5.2.2.1 GD Method)'''
def W_v(W_TO, n_ult, S_v, M_H, l_v, S_r, A_v, λ_v, Λ_qtrchrd_v):
assert Λ_qtrchrd_v.unit == 'rad'
curly_bracket = (W_TO * n_ult) ** 0.363 * S_v ** 1.089 * M_H ** 0.601 * l_v ** -0.726 * (1 + S_r / S_v) ** 0.217 * \
A_v ** 0.337 * (1 + λ_v) ** 0.363 * math.cos(Λ_qtrchrd_v.value) ** -0.484
return 0.19 * curly_bracket ** 1.014
W_v = W_v(W_TO, n_ult, S_v, M_H, l_v, S_r, A_v, λ_v, Λ_qtrchrd_v)
weights.append(W_v.value)
labels.append('Vertical Tail')
'''
Fuselage Weight
-pg. 76 Roskam
(Section 5.3.2.1 GD Method)
Equation 5.26'''
def W_f(K_inl, q_bar_D, W_TO, l_f, h_f):
return 10.43 * K_inl ** 1.42 * (q_bar_D / 100) ** 0.283 * (W_TO / 1000) ** 0.95 * (l_f / h_f) ** 0.71
W_f = W_f(K_inl, q_bar_D, W_TO, l_f, h_f)
weights.append(W_f.value)
labels.append('Fuselage')
'''
Engine Nacelle Weight
-pg.80 Roskam
(Section 5.4.2.1)
Section 5.4.4 said to use eqs. 5.34 or 5.35 for attack aircraft
Use 5.34 since we have a turbojet'''
def W_n(N_inl, A_inl, l_n, P_2):
curly = A_inl ** 0.5 * l_n * P_2
W_n = 3.0 * N_inl * curly ** 0.731
return W_n.value
W_n = W_n(N_inl, A_inl, l_n, P_2)
weights.append(W_n)
labels.append('Nacelle')
'''
Landing Gear Weight Estimation
-pg 80 Roskam
(Section 5.5.4 Fighter and Attack Airplanes reccommends using eqs. 5.41 and 5.42)
Will use eq.5.41 for now'''
def W_g(W_TO):
W_g = 62.21 * (W_TO / 1000) ** 0.84
return W_g.value
W_g = W_g(W_TO)
weights.append(W_g)
labels.append('Landing Gear')
'''
Power Plant Weight
For now, will just assume value for 2 F404-GE-402 engines (used in F-18)
assuming each engine weighs 2282 lbf'''
weights.append(W_pwr)
labels.append('Powerplant')
'''
Fuel Systems Weight
-pg.92 Roskam
(Section 6.4.2.1)
assuming self-sealing bladder tanks'''
def W_fs(W_F, K_fsp, W_supp):
curly = (W_F / K_fsp) / 100
W_fs = 41.6 * curly.value ** 0.818 + W_supp.value
return W_fs
W_fs = W_fs(W_F, K_fsp, W_supp)
weights.append(W_fs)
labels.append('Fuel Systems')
'''
Flight Control System Weight
-pg.100
(Section 7.1.4.1)
'''
def W_fc(W_TO, K_fcf):
W_fc = K_fcf * (W_TO / 1000) ** 0.581
return W_fc.value
W_fc = W_fc(W_TO, K_fcf)
weights.append(W_fc)
labels.append('FCS')
'''
Hydraulic and Pneumatic System Weight
-pg.100
(Included in flight control system weight (W_fc))'''
####################################################################################################################
'''
Instrumentation, Avionics and Electronics System Weight Estimation
-pg.103
(Section 7.4.2.1 USAF Attack Aircraft)
In book, W_i is used but really it refers to W_iae'''
def W_iae(N_pil, W_TO, N_e):
W_TO = W_TO.value
curl1 = 15 + 0.032 * (W_TO / 1000)
curl2 = 5 + 0.006 * (W_TO / 1000)
Other_inst = 0.15 * (W_TO / 1000) + 0.012 * W_TO
W_iae = N_pil * curl1 + N_e * curl2 + Other_inst
return W_iae
W_iae = W_iae(N_pil, W_TO, N_e)
weights.append(W_iae)
labels.append('Avionics')
'''
Electrical System Weight Estimation
-pg.102
(Section 7.3.4.1 USAF Attack Aircraft)'''
def W_els(W_fs, W_iae):
curl = (W_fs + W_iae) / 1000
W_els = 426 * curl ** 0.51
return W_els
W_els = W_els(W_fs, W_iae)
weights.append(W_els)
labels.append('Elec. Systems')
'''
Air Conditioning, Pressurization, Anti/Deicing Systems Weights (W_api)
-pg.105
(Section 7.5.4.1) eq.7.34 since we are high subsonic'''
N_cr = 1 # number of crew (Should refer to pilots plus anybody else on board)
def W_api(W_iae, N_cr):
curl = (W_iae + 200 * N_cr) / 1000
W_api = 202 * curl ** 0.735
return W_api
W_api = W_api(W_iae, N_cr)
weights.append(W_api)
labels.append('Env. Systems')
'''
Oxygen System Weight
-pg.106
(Section 7.6.4.1'''
def W_ox(N_cr):
return 16.9 * N_cr ** 1.494
W_ox = W_ox(N_cr)
weights.append(W_ox)
labels.append('O2 System')
'''
Auxiliary Power Unit Weight (APU)
-pg.107
Eq.7.40'''
W_apu = APU_est_factor * W_TO
weights.append(W_apu.value)
labels.append('APU')
'''
Furnishings
-pg.109
(Section 7.8.4)
In this case refers to ejection seats and emergency equipment'''
def W_fur(N_cr, q_bar_D, W_TO):
ejection_seats = 22.9 * ((N_cr * q_bar_D) / 100) ** 0.743
equip = 107 * ((N_cr * W_TO) / 100000) ** 0.585
equip = equip.value
ejection_seats = ejection_seats.value
return ejection_seats + equip
W_fur = W_fur(N_cr, q_bar_D, W_TO)
weights.append(W_fur)
labels.append('Furnishings')
'''
Payload Weight
-pg.111
just use payload weight for now'''
weights.append(W_pay.value)
labels.append('Payload')
'''
Aux Gear (Manufacturers variation)
-pg.111
Eq. 7.50'''
W_E = W_TO - W_pay - W_F
def W_aux(W_E):
return 0.01 * W_E
W_aux = W_aux(W_E)
weights.append(W_aux.value)
labels.append('Manu. Variation')
'''
Paint Weight
-pg.112
(Eq.7.51)'''
def W_pt(W_TO):
return PAINT_EST_FACTOR * W_TO
W_pt = W_pt(W_TO)
weights.append(W_pt.value)
labels.append('Paint')
weights.append(W_F.value)
labels.append('Fuel')
for name, weight in zip(labels, weights):
Estimate(name, weight)
# print("Empty Weight: ", W_E.value)
#
# W_total = sum(weights)
# print('Total Weight: ', W_total)
# print(weights)
# print(labels)
inputs = locals().copy()
# with open("Week8/inputs.txt", "a") as datafile:
# for d in inputs:
# datafile.write(d+"\n")
# zipped = list(zip(labels,weights))
# print(zipped)
# with open("data.txt", "a") as datafile:
# for index, w in enumerate(weights):
# datafile.write(labels[index]+"\t"+str(w)+"\n")