-
Notifications
You must be signed in to change notification settings - Fork 2
/
design_opt.py
1327 lines (1150 loc) · 38.5 KB
/
design_opt.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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import aerosandbox as asb
import aerosandbox.numpy as np
from aerosandbox.library import aerodynamics as lib_aero
from aerosandbox.library.weights import torenbeek_weights, raymer_cargo_transport_weights, raymer_miscellaneous
from aerosandbox.tools import units as u
import copy
from typing import Union, Callable, Optional
##### Section: Initialize Optimization
opti = asb.Opti(
freeze_style='float'
)
##### Section: Parameters
mission_range = 7500 * u.naut_mile
# mission_range = opti.variable(init_guess=2500 * u.naut_mile)
n_pax = 400
# fuel_type = "kerosene"
fuel_type = "LH2"
# fuel_type = "GH2"
reference_engine = "GE9X"
# reference_engine = "GE90"
##### Section: Fuel Properties
if fuel_type == "LH2":
fuel_tank_wall_thickness = 0.0612 # from Brewer, Hydrogen Aircraft Technology pg. 203
fuel_density = 70 # kg/m^3
fuel_specific_energy = 119.93e6 # J/kg; lower heating value due to liquid start
fuel_tank_fuel_mass_fraction = opti.parameter(1 / (1 + 0.356)) # from Brewer, Hydrogen Aircraft Technology pg. 203
fuel_placement = "fuselage"
elif fuel_type == "GH2":
fuel_tank_wall_thickness = 0.0612 # from Brewer, Hydrogen Aircraft Technology pg. 203
fuel_density = 42 # kg/m^3
fuel_specific_energy = 141.80e6 # J/kg; higher heating value due to gas start
fuel_tank_fuel_mass_fraction = 0.11 # Paul Eremenko, Universal Hydrogen
fuel_placement = "fuselage"
elif fuel_type == "kerosene":
fuel_tank_wall_thickness = 0.005
fuel_density = 820 # kg/m^3
fuel_specific_energy = 43.02e6 # J/kg
fuel_tank_fuel_mass_fraction = 0.993
fuel_placement = "wing"
else:
raise ValueError("Bad value of `fuel_type`!")
##### Section: Vehicle Definition
"""
Coordinate system:
Geometry axes. Datum is:
* x=0 is set at the YZ plane coincident with the nose of the airplane.
* y=0 and z=0 are both set by the centerline of the fuselage.
Note that the nose of the airplane is slightly below (-z) the centerline of the fuselage.
"""
### Fuselage
fuselage_cabin_diameter = opti.variable(
init_guess=6.20, # 20.4 * u.foot,
lower_bound=1.5,
upper_bound=12,
# freeze=True,
)
fuselage_cabin_radius = fuselage_cabin_diameter / 2
fuselage_cabin_xsec_area = np.pi * fuselage_cabin_radius ** 2
fuselage_cabin_length = ( # Scaled to keep constant (fuselage planform area / passenger) as 777-300ER
46 # (123.2 * u.foot) *
* (6.20 / fuselage_cabin_diameter) ** (1.58)
# Exponent is an empirically tuned parameter assuming the B777 value of 6.20 m is the result of some unconstrained optimum
* (n_pax / 396)
)
if fuel_placement == "fuselage":
fwd_fuel_tank_length = opti.variable(
init_guess=6,
lower_bound=1e-3,
log_transform=True
)
aft_fuel_tank_length = fwd_fuel_tank_length
elif fuel_placement == "wing":
fuel_mass = opti.variable(
init_guess=50e3,
lower_bound=1e-3
)
fwd_fuel_tank_length = 0
aft_fuel_tank_length = 0
else:
raise ValueError("Bad value of `fuel_placement`!")
# Compute x-locations of various fuselage stations
nose_fineness_ratio = 1.67
tail_fineness_ratio = 2.62
x_nose = 0
x_nose_to_fwd_tank = x_nose + nose_fineness_ratio * fuselage_cabin_diameter
x_fwd_tank_to_cabin = x_nose_to_fwd_tank + fwd_fuel_tank_length
x_cabin_to_aft_tank = x_fwd_tank_to_cabin + fuselage_cabin_length
x_aft_tank_to_tail = x_cabin_to_aft_tank + aft_fuel_tank_length
x_tail = x_aft_tank_to_tail + tail_fineness_ratio * fuselage_cabin_diameter
# Build up the actual fuselage nodes
x_fuse_sections = []
z_fuse_sections = []
r_fuse_sections = []
def linear_map(
f_in: Union[float, np.ndarray],
min_in: Union[float, np.ndarray],
max_in: Union[float, np.ndarray],
min_out: Union[float, np.ndarray],
max_out: Union[float, np.ndarray],
) -> Union[float, np.ndarray]:
"""
Linearly maps an input `f_in` from range (`min_in`, `max_in`) to (`min_out`, `max_out`).
Args:
f_in: Input value
min_in:
max_in:
min_out:
max_out:
Returns:
f_out: Output value
"""
# if min_in == 0 and max_in == 1:
# f_nondim = f_in
# else:
f_nondim = (f_in - min_in) / (max_in - min_in)
# if max_out == 0 and min_out == 1:
# f_out = f_nondim
# else:
f_out = f_nondim * (max_out - min_out) + min_out
return f_out
# Nose
x_sect_nondim = np.sinspace(0, 1, 10)
z_sect_nondim = -0.3 * (1 - x_sect_nondim) ** 2
r_sect_nondim = (1 - (1 - x_sect_nondim) ** 2) ** 0.5
x_fuse_sections.append(
linear_map(
f_in=x_sect_nondim,
min_in=0, max_in=1,
min_out=x_nose, max_out=x_nose_to_fwd_tank
)
)
z_fuse_sections.append(
linear_map(
f_in=z_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
r_fuse_sections.append(
linear_map(
f_in=r_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
if fuel_placement == "fuselage":
# Fwd tank
x_sect_nondim = np.linspace(0, 1, 2)
z_sect_nondim = np.zeros_like(x_sect_nondim)
r_sect_nondim = np.ones_like(x_sect_nondim)
x_fuse_sections.append(
linear_map(
f_in=x_sect_nondim,
min_in=0, max_in=1,
min_out=x_nose_to_fwd_tank, max_out=x_fwd_tank_to_cabin
)
)
z_fuse_sections.append(
linear_map(
f_in=z_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
r_fuse_sections.append(
linear_map(
f_in=r_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
# Cabin
x_sect_nondim = np.linspace(0, 1, 2)
z_sect_nondim = np.zeros_like(x_sect_nondim)
r_sect_nondim = np.ones_like(x_sect_nondim)
x_fuse_sections.append(
linear_map(
f_in=x_sect_nondim,
min_in=0, max_in=1,
min_out=x_fwd_tank_to_cabin, max_out=x_cabin_to_aft_tank
)
)
z_fuse_sections.append(
linear_map(
f_in=z_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
r_fuse_sections.append(
linear_map(
f_in=r_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
# Aft Tank
if fuel_placement == "fuselage":
x_sect_nondim = np.linspace(0, 1, 2)
z_sect_nondim = np.zeros_like(x_sect_nondim)
r_sect_nondim = np.ones_like(x_sect_nondim)
x_fuse_sections.append(
linear_map(
f_in=x_sect_nondim,
min_in=0, max_in=1,
min_out=x_cabin_to_aft_tank, max_out=x_aft_tank_to_tail
)
)
z_fuse_sections.append(
linear_map(
f_in=z_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
r_fuse_sections.append(
linear_map(
f_in=r_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
# Tail
x_sect_nondim = np.linspace(0, 1, 10)
z_sect_nondim = 1 * x_sect_nondim ** 1.5
r_sect_nondim = 1 - x_sect_nondim ** 1.5
x_fuse_sections.append(
linear_map(
f_in=x_sect_nondim,
min_in=0, max_in=1,
min_out=x_aft_tank_to_tail, max_out=x_tail
)
)
z_fuse_sections.append(
linear_map(
f_in=z_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
r_fuse_sections.append(
linear_map(
f_in=r_sect_nondim,
min_in=0, max_in=1,
min_out=0, max_out=fuselage_cabin_radius
)
)
# Compile Fuselage
x_fuse_sections = np.concatenate([
x_fuse_section[:-1] if i != len(x_fuse_sections) - 1 else x_fuse_section
for i, x_fuse_section in enumerate(x_fuse_sections)
])
z_fuse_sections = np.concatenate([
z_fuse_section[:-1] if i != len(z_fuse_sections) - 1 else z_fuse_section
for i, z_fuse_section in enumerate(z_fuse_sections)
])
r_fuse_sections = np.concatenate([
r_fuse_section[:-1] if i != len(r_fuse_sections) - 1 else r_fuse_section
for i, r_fuse_section in enumerate(r_fuse_sections)
])
fuse = asb.Fuselage(
name="Fuselage",
xsecs=[
asb.FuselageXSec(
xyz_c=[
x_fuse_sections[i],
0,
z_fuse_sections[i]
],
radius=r_fuse_sections[i]
)
for i in range(np.length(x_fuse_sections))
],
analysis_specific_options={
asb.AeroBuildup: dict(
nose_fineness_ratio=nose_fineness_ratio
)
}
)
### Wing
wing_airfoil = asb.Airfoil("b737c").repanel(100)
wing_airfoil.generate_polars(
cache_filename="cache/b737c.json",
include_compressibility_effects=True,
)
wing_span = opti.variable(
init_guess=214 * u.foot,
lower_bound=0,
upper_bound=64.8
# freeze=True
)
wing_half_span = wing_span / 2
wing_root_chord = opti.variable(
init_guess=51.5 * u.foot,
lower_bound=0,
freeze=True,
)
wing_LE_sweep_deg = opti.variable(
init_guess=34,
lower_bound=0,
freeze=True,
)
wing_yehudi_span_fraction = 0.25
wing_dihedral = 6
# Compute the y locations
wing_yehudi_y = wing_yehudi_span_fraction * wing_half_span
wing_tip_y = wing_half_span
# Compute the x locations
wing_yehudi_x = wing_yehudi_y * np.tand(wing_LE_sweep_deg)
wing_tip_x = wing_tip_y * np.tand(wing_LE_sweep_deg)
# Compute the chords
wing_yehudi_chord = wing_root_chord - wing_yehudi_x
wing_tip_chord = 0.14 * wing_root_chord
# Make the sections
wing_root = asb.WingXSec(
xyz_le=[0, 0, 0],
chord=wing_root_chord,
airfoil=wing_airfoil,
)
wing_yehudi = asb.WingXSec(
xyz_le=[
wing_yehudi_x,
wing_yehudi_y,
wing_yehudi_y * np.tand(wing_dihedral)
],
chord=wing_yehudi_chord,
airfoil=wing_airfoil,
)
wing_tip = asb.WingXSec(
xyz_le=[
wing_tip_x,
wing_tip_y,
wing_tip_y * np.tand(wing_dihedral)
],
chord=wing_tip_chord,
airfoil=wing_airfoil
)
# Assemble the wing
wing_x_le = opti.variable(
init_guess=0.5 * x_fwd_tank_to_cabin + 0.5 * x_cabin_to_aft_tank - 0.5 * wing_root_chord,
freeze=True
)
wing_z_le = -0.5 * fuselage_cabin_radius
wing = asb.Wing(
name="Main Wing",
symmetric=True,
xsecs=[
wing_root,
wing_yehudi,
wing_tip
]
).translate([
wing_x_le,
0,
wing_z_le
]).subdivide_sections(2)
### Horizontal Stabilizer
hstab_airfoil = asb.Airfoil("naca0012")
hstab_airfoil.generate_polars(
cache_filename="cache/naca0012.json",
include_compressibility_effects=True
)
hstab_span = opti.variable(
init_guess=70.8 * u.foot * (64.8 / 60.9),
lower_bound=0,
freeze=True
)
hstab_half_span = hstab_span / 2
hstab_root_chord = opti.variable(
init_guess=23 * u.foot,
lower_bound=0,
freeze=True
)
hstab_LE_sweep_deg = opti.variable(
init_guess=37,
lower_bound=0,
freeze=True
)
hstab_root = asb.WingXSec(
xyz_le=[0, 0, 0],
chord=hstab_root_chord,
airfoil=hstab_airfoil,
control_surfaces=[
asb.ControlSurface(
name="elevator",
deflection=opti.variable(
init_guess=0,
lower_bound=-45,
upper_bound=45,
# freeze=True
)
)
]
)
hstab_tip = asb.WingXSec(
xyz_le=[
hstab_half_span * np.tand(hstab_LE_sweep_deg),
hstab_half_span,
0
],
chord=0.35 * hstab_root_chord,
airfoil=hstab_airfoil
)
# Assemble the hstab
hstab_x_le = x_tail - 1.5 * hstab_root_chord
hstab_z_le = 0.5 * fuselage_cabin_radius
hstab = asb.Wing(
name="Horizontal Stabilizer",
symmetric=True,
xsecs=[
hstab_root,
hstab_tip
]
).translate([
hstab_x_le,
0,
hstab_z_le
]).subdivide_sections(2)
### Vertical Stabilizer
vstab_airfoil = asb.Airfoil("naca0008")
vstab_airfoil.generate_polars(
cache_filename="cache/naca0008.json",
include_compressibility_effects=True
)
vstab_span = opti.variable(
init_guess=29.6 * u.foot,
lower_bound=0,
# freeze=True
)
vstab_root_chord = opti.variable(
init_guess=22 * u.foot,
lower_bound=0,
upper_bound=wing_root_chord,
# freeze=True
)
vstab_LE_sweep_deg = opti.variable(
init_guess=40,
lower_bound=0,
freeze=True
)
vstab_root = asb.WingXSec(
xyz_le=[0, 0, 0],
chord=vstab_root_chord,
airfoil=vstab_airfoil
)
vstab_tip = asb.WingXSec(
xyz_le=[
vstab_span * np.tand(vstab_LE_sweep_deg),
0,
vstab_span,
],
chord=0.35 * vstab_root_chord,
airfoil=vstab_airfoil
)
# Assemble the vstab
vstab_x_le = x_tail - 1.5 * vstab_root_chord
vstab_z_le = 0.75 * fuselage_cabin_radius
vstab = asb.Wing(
name="Vertical Stabilizer",
xsecs=[
vstab_root,
vstab_tip
]
).translate([
vstab_x_le,
0,
vstab_z_le
]).subdivide_sections(2)
### Airplane
airplane = asb.Airplane(
name="Airplane",
xyz_ref=[],
wings=[
wing,
hstab,
vstab
],
fuselages=[
fuse
],
)
##### Section: Vehicle Overall Specs
design_mass_TOGW = opti.variable(
init_guess=299370,
log_transform=True
# freeze=True
)
ultimate_load_factor = 1.5 * 2.5
n_engines = 2
if n_engines <= 2:
required_engine_out_climb_gradient = 2.4
elif n_engines == 3:
required_engine_out_climb_gradient = 2.7
else:
required_engine_out_climb_gradient = 3.0
LD_cruise = opti.variable(
init_guess=15,
log_transform=True,
)
g = 9.81
LD_engine_out = 0.50 * LD_cruise # accounting for flaps, gear down, imperfect flying
design_thrust_cruise_total = (
design_mass_TOGW * g / LD_cruise # cruise component
)
design_max_thrust_engine = (
design_mass_TOGW * g / LD_engine_out +
design_mass_TOGW * g * (required_engine_out_climb_gradient / 100)
) / (n_engines - 1)
mach_cruise = opti.variable(
init_guess=0.82,
scale=0.1,
lower_bound=0,
upper_bound=1
)
altitude_cruise = opti.variable(
init_guess=35e3 * u.foot,
scale=10e3 * u.foot,
lower_bound=18e3 * u.foot, # Speed regulations
upper_bound=400e3 * u.foot,
# freeze=True
)
atmo = asb.Atmosphere(altitude=altitude_cruise)
V_cruise = mach_cruise * atmo.speed_of_sound()
##### Section: Internal Geometry and Weights
mass_props = {}
# Compute useful x stations
x_cabin_midpoint = (x_fwd_tank_to_cabin + x_cabin_to_aft_tank) / 2
# Passenger weight
mass_props["passengers"] = asb.mass_properties_from_radius_of_gyration(
mass=(215 * u.lbm) * n_pax,
x_cg=x_cabin_midpoint,
radius_of_gyration_x=0.5 * fuselage_cabin_radius,
radius_of_gyration_y=fuselage_cabin_length / 12 ** 0.5,
radius_of_gyration_z=fuselage_cabin_length / 12 ** 0.5,
)
# Seat weight
mass_props["seats"] = asb.mass_properties_from_radius_of_gyration(
mass=0.10 * mass_props["passengers"].mass, # from TASOPT
x_cg=x_cabin_midpoint,
radius_of_gyration_x=0.5 * fuselage_cabin_radius,
radius_of_gyration_y=fuselage_cabin_length / 12 ** 0.5,
radius_of_gyration_z=fuselage_cabin_length / 12 ** 0.5,
)
# Mass of the auxiliary power unit (APU), from TASOPT.
mass_props["apu"] = asb.mass_properties_from_radius_of_gyration(
mass=0.035 * mass_props["passengers"].mass, # from TASOPT
x_cg=x_cabin_midpoint,
radius_of_gyration_x=0.5 * fuselage_cabin_radius,
radius_of_gyration_y=fuselage_cabin_length / 12 ** 0.5,
radius_of_gyration_z=fuselage_cabin_length / 12 ** 0.5,
)
# Additional payload-proportional weight, from TASOPT:
# "flight attendants, food, galleys, toilets, luggage compartments and furnishings, doors, lighting,
# air conditioning systems, in-flight entertainment systems, etc. These are also assumed
# to be uniformly distributed on average."
mass_props["payload_proportional_weights"] = asb.mass_properties_from_radius_of_gyration(
mass=0.35 * mass_props["passengers"].mass, # from TASOPT
x_cg=x_cabin_midpoint,
radius_of_gyration_x=0.5 * fuselage_cabin_radius,
radius_of_gyration_y=fuselage_cabin_length / 12 ** 0.5,
radius_of_gyration_z=fuselage_cabin_length / 12 ** 0.5,
)
# Mass of the buoyancy (e.g., air in the pressurized cabin).
# This is because the pressurized cabin air has a higher density than the ambient air at altitude.
cabin_atmo = asb.Atmosphere(
altitude=8000 * u.foot # pressure altitude inside cabin
)
mass_props["buoyancy"] = asb.mass_properties_from_radius_of_gyration(
mass=(
np.softmax(cabin_atmo.density() - atmo.density(), 0, hardness=100) *
fuselage_cabin_xsec_area * fuselage_cabin_length
),
x_cg=x_cabin_midpoint,
radius_of_gyration_x=0.5 * fuselage_cabin_radius,
radius_of_gyration_y=fuselage_cabin_length / 12 ** 0.5,
radius_of_gyration_z=fuselage_cabin_length / 12 ** 0.5,
)
# Fuel and fuel tank masses
if fuel_placement == "fuselage":
fwd_fuel_tank_exterior_volume = fuselage_cabin_xsec_area * fwd_fuel_tank_length
aft_fuel_tank_exterior_volume = fuselage_cabin_xsec_area * aft_fuel_tank_length
fuel_tank_interior_radius = fuselage_cabin_radius - fuel_tank_wall_thickness
fuel_tank_xsec_area = np.pi * fuel_tank_interior_radius ** 2
fwd_fuel_tank_interior_volume = fuel_tank_xsec_area * (fwd_fuel_tank_length - 2 * fuel_tank_wall_thickness)
aft_fuel_tank_interior_volume = fuel_tank_xsec_area * (aft_fuel_tank_length - 2 * fuel_tank_wall_thickness)
fuel_tank_interior_volume = fwd_fuel_tank_interior_volume + aft_fuel_tank_interior_volume
x_fwd_tank_midpoint = (x_nose_to_fwd_tank + x_fwd_tank_to_cabin) / 2
x_aft_tank_midpoint = (x_cabin_to_aft_tank + x_aft_tank_to_tail) / 2
mass_props_full_fuel_fwd = asb.mass_properties_from_radius_of_gyration(
mass=fuel_density * fwd_fuel_tank_interior_volume,
x_cg=x_fwd_tank_midpoint,
)
mass_props_full_fuel_aft = asb.mass_properties_from_radius_of_gyration(
mass=fuel_density * aft_fuel_tank_interior_volume,
x_cg=x_aft_tank_midpoint
)
mass_props["fuel"] = mass_props_full_fuel_fwd + mass_props_full_fuel_aft
elif fuel_placement == "wing":
mass_props["fuel"] = asb.mass_properties_from_radius_of_gyration(
mass=fuel_mass,
x_cg=wing.aerodynamic_center(chord_fraction=0.5)[0],
radius_of_gyration_x=0.3 * 0.5 * wing_span,
radius_of_gyration_z=0.3 * 0.5 * wing_span,
)
fuel_tank_interior_volume = fuel_mass / fuel_density
else:
raise ValueError("Bad value of `fuel_placement`!")
mass_props["tanks"] = mass_props["fuel"] / fuel_tank_fuel_mass_fraction * (1 - fuel_tank_fuel_mass_fraction)
# Fuel system (lines, pumps) mass
fuel_volume = fuel_tank_interior_volume
if fuel_type == "kerosene":
fuel_system_mass_multiplier = 1
elif fuel_type == "LH2":
fuel_system_mass_multiplier = 2.2
elif fuel_type == "GH2":
fuel_system_mass_multiplier = 2.0
else:
raise ValueError("Bad value of `fuel_type`!")
mass_props["fuel_system"] = asb.mass_properties_from_radius_of_gyration(
mass=(
2.405 *
(fuel_volume / u.gallon) ** 0.606 *
0.5 * # Assume all fuel tanks are integral tanks
n_engines ** 0.5 * # Assume one fuel tank per engine
fuel_system_mass_multiplier
) * u.lbm
)
# Wing Mass
# mass_props["wing"] = asb.mass_properties_from_radius_of_gyration(
# mass=(
# 0.0051 *
# (design_mass_TOGW / u.lbm * ultimate_load_factor) ** 0.557 *
# (wing.area() / u.foot ** 2) ** 0.649 *
# wing.aspect_ratio() ** 0.5 *
# wing_airfoil.max_thickness() ** -0.4 *
# (1 + wing.taper_ratio()) ** 0.1 *
# np.cosd(wing.mean_sweep_angle()) ** -1 *
# (wing.area() / u.foot ** 2 * 0.1) ** 0.1
# ) * u.lbm,
# x_cg=wing.aerodynamic_center(chord_fraction=0.40)[0],
# radius_of_gyration_x=wing_span / 12 ** 0.5,
# radius_of_gyration_y=wing_root_chord / 12 ** 0.5,
# radius_of_gyration_z=wing_span / 12 ** 0.5,
# )
suspended_mass = opti.variable(
init_guess=100e3,
lower_bound=0,
)
mass_props["wing"] = asb.mass_properties_from_radius_of_gyration(
mass=torenbeek_weights.mass_wing(
wing=wing,
design_mass_TOGW=design_mass_TOGW,
ultimate_load_factor=ultimate_load_factor,
suspended_mass=suspended_mass,
never_exceed_airspeed=atmo.speed_of_sound(),
max_airspeed_for_flaps=160 * u.knot,
main_gear_mounted_to_wing=True,
),
x_cg=wing.aerodynamic_center(chord_fraction=0.40)[0],
z_cg=wing.aerodynamic_center(chord_fraction=0.40)[2],
radius_of_gyration_x=wing_span / 12 ** 0.5,
radius_of_gyration_y=wing_root_chord / 12 ** 0.5,
radius_of_gyration_z=wing_span / 12 ** 0.5,
)
if fuel_placement == "wing":
opti.subject_to(
suspended_mass / 100e3 > (
design_mass_TOGW - mass_props["wing"].mass
- mass_props["fuel"].mass - mass_props["tanks"].mass
- mass_props["fuel_system"].mass
) / 100e3
)
elif fuel_placement == "fuselage":
opti.subject_to(
suspended_mass / 100e3 > (
design_mass_TOGW - mass_props["wing"].mass
) / 100e3
)
else:
raise ValueError(f"Invalid fuel placement: {fuel_placement}")
# HStab Mass
wing_to_hstab_distance = hstab.aerodynamic_center()[0] - wing.aerodynamic_center()[0]
mass_props["hstab"] = asb.mass_properties_from_radius_of_gyration(
mass=(
0.0379 *
1 *
(1 + fuselage_cabin_diameter / hstab_span) ** -0.25 *
(design_mass_TOGW / u.lbm) ** 0.639 *
ultimate_load_factor ** 0.10 *
(hstab.area() / u.foot ** 2) ** 0.75 *
(wing_to_hstab_distance / u.foot) ** -1 *
(0.3 * wing_to_hstab_distance / u.foot) ** 0.704 *
np.cosd(hstab.mean_sweep_angle()) ** -1 *
hstab.aspect_ratio() ** 0.166 *
(1 + 0.1) ** 0.1
) * u.lbm,
x_cg=hstab.aerodynamic_center(chord_fraction=0.5)[0],
z_cg=vstab.aerodynamic_center(chord_fraction=0.5)[2],
radius_of_gyration_x=hstab_span / 12 ** 0.5,
radius_of_gyration_y=hstab_root_chord / 12 ** 0.5,
radius_of_gyration_z=hstab_span / 12 ** 0.5,
)
# VStab Mass
wing_to_vstab_distance = vstab.aerodynamic_center()[0] - wing.aerodynamic_center()[0]
mass_props["vstab"] = asb.mass_properties_from_radius_of_gyration(
mass=(
0.0026 *
(1 + 0) ** 0.225 *
(design_mass_TOGW / u.lbm) ** 0.556 *
ultimate_load_factor ** 0.536 *
(wing_to_vstab_distance / u.foot) ** -0.5 *
(vstab.area() / u.foot ** 2) ** 0.5 *
(wing_to_vstab_distance / u.foot) ** 0.875 *
np.cosd(vstab.mean_sweep_angle()) ** -1 *
vstab.aspect_ratio() ** 0.35 *
vstab_airfoil.max_thickness() ** -0.5
) * u.lbm,
x_cg=vstab.aerodynamic_center(chord_fraction=0.5)[0],
z_cg=vstab.aerodynamic_center(chord_fraction=0.5)[2],
radius_of_gyration_x=vstab_span / 12 ** 0.5,
radius_of_gyration_y=vstab_root_chord / 12 ** 0.5,
radius_of_gyration_z=vstab_span / 12 ** 0.5,
)
# Fuselage structure mass
mass_props["fuselage"] = asb.mass_properties_from_radius_of_gyration(
# mass=raymer_cargo_transport_weights.mass_fuselage(
# fuselage=fuse,
# design_mass_TOGW=design_mass_TOGW,
# ultimate_load_factor=ultimate_load_factor,
# L_over_D=LD_cruise,
# main_wing=wing,
# n_cargo_doors=2,
# has_aft_clamshell_door=True,
# ),
mass=torenbeek_weights.mass_fuselage_simple(
fuselage=fuse,
never_exceed_airspeed=atmo.speed_of_sound(),
wing_to_tail_distance=wing_to_hstab_distance,
),
x_cg=x_cabin_midpoint,
radius_of_gyration_x=0.5 * fuselage_cabin_radius,
radius_of_gyration_y=fuselage_cabin_length / 12 ** 0.5,
radius_of_gyration_z=fuselage_cabin_length / 12 ** 0.5,
)
# Engine mass
# Size/weight estimates relative to a GE9X
if reference_engine == "GE9X":
ref_engine = dict(
thrust=110000 * u.lbf,
fan_diameter=134 * u.inch,
outer_diameter=163.7 * u.inch,
mass=21230 * u.lbm,
TSFC_lb_lb_hour=0.490 # lb/lb-hr
)
elif reference_engine == "GE90":
ref_engine = dict(
thrust=97300 * u.lbf,
fan_diameter=123 * u.inch,
outer_diameter=134 * u.inch,
mass=17400 * u.lbm,
TSFC_lb_lb_hour=0.520 # lb/lb-hr
)
else:
raise ValueError("Bad value of `reference_engine`!")
ref_engine["Isp"] = 3600 / ref_engine["TSFC_lb_lb_hour"]
Isp = ref_engine["Isp"] * (fuel_specific_energy / 43.02e6)
design_max_thrust_ratio_to_ref_engine = (
design_max_thrust_engine /
ref_engine["thrust"]
)
engine_fan_diameter = ref_engine["fan_diameter"] * design_max_thrust_ratio_to_ref_engine ** 0.5
engine_outer_diameter = ref_engine["outer_diameter"] * design_max_thrust_ratio_to_ref_engine ** 0.5
x_engines = wing_x_le + wing_yehudi_x
mass_props["engines"] = asb.mass_properties_from_radius_of_gyration(
mass=(
n_engines * ref_engine["mass"] *
design_max_thrust_ratio_to_ref_engine ** 1.1
),
x_cg=x_engines
)
# Landing gear mass
main_landing_gear_length = np.softmax(
1.1 * engine_outer_diameter,
(fuse.length() / 2) * np.tand(3.5),
hardness=10
)
main_landing_gear_n_wheels = 6
main_landing_gear_n_shock_struts = 2
main_landing_gear_design_V_stall = 51 * u.knot
mass_props["main_landing_gear"] = asb.mass_properties_from_radius_of_gyration(
mass=(
0.0106 *
1 * # non-kneeling LG
(design_mass_TOGW / u.lbm) ** 0.888 *
(ultimate_load_factor) ** 0.25 *
(main_landing_gear_length / u.inch) ** 0.4 *
(main_landing_gear_n_wheels) ** 0.321 *
(main_landing_gear_n_shock_struts) ** -0.5 *
(main_landing_gear_design_V_stall / u.knot) ** 0.1
) * u.lbm,
x_cg=wing.xsecs[0].xyz_le[0] + wing.xsecs[0].chord
)
nose_landing_gear_length = 0.9 / 1.1 * main_landing_gear_length
nose_landing_gear_n_wheels = 2
mass_props["nose_landing_gear"] = asb.mass_properties_from_radius_of_gyration(
mass=(
0.032 *
1 * # non-reciprocating engine
(design_mass_TOGW / u.lbm) ** 0.646 *
(ultimate_load_factor) ** 0.2 *
(nose_landing_gear_length / u.inch) ** 0.5 *
(nose_landing_gear_n_wheels) ** 0.45
) * u.lbm,
x_cg=x_nose_to_fwd_tank
)
# Nacelle mass
nacelle_height = 0.5 * engine_outer_diameter
nacelle_width = 0.2 * engine_outer_diameter
nacelle_length = 0.5 * engine_outer_diameter
mass_engine_and_contents = (
2.331 *
(mass_props["engines"].mass / u.lbm / n_engines) ** 0.901 *
1.0 * # no propeller
1.18 # thrust reverser
) * u.lbm
nacelle_wetted_area = nacelle_height * nacelle_length * 2.05
mass_props["nacelles"] = asb.mass_properties_from_radius_of_gyration(
mass=(
0.6724 *
1.017 * # pylon-mounted nacelle
(nacelle_height / u.foot) ** 0.10 *
(nacelle_width / u.foot) ** 0.294 *
(ultimate_load_factor) ** 0.119 *
(mass_engine_and_contents / u.lbm) ** 0.611 *
(n_engines) ** 0.984 *
(nacelle_wetted_area / u.foot ** 2) ** 0.224
)
)
# Engine controls & Engine starter mass
mass_props["engine_controls"] = asb.mass_properties_from_radius_of_gyration(
mass=(
5 * n_engines +
0.80 * (x_cabin_midpoint / u.foot) * n_engines
) * u.lbm,
x_cg=(x_engines + x_nose) / 2,
)
mass_props["starter"] = asb.mass_properties_from_radius_of_gyration(
mass=(
49.19 * (
mass_props["engines"].mass / u.lbm
/ 1000
) ** 0.541
) * u.lbm,
x_cg=x_engines
)
# Flight controls mass
control_surface_area = 0.15 * (
wing.area() +
hstab.area() +
vstab.area()
)
control_surface_sizing_Iyy_aircraft = (
design_mass_TOGW * wing_to_hstab_distance ** 2
)
mass_props["flight_controls"] = asb.mass_properties_from_radius_of_gyration(
mass=(
145.9 *
6 ** 0.554 * # number of functions performed by controls
(1 + 1 / 6) ** -1 *
(control_surface_area / u.foot ** 2) ** 0.20 *
(control_surface_sizing_Iyy_aircraft / (u.lbm * u.foot ** 2) * 1e-6) ** 0.07
) * u.lbm,
x_cg=(
0.5 * wing.aerodynamic_center(chord_fraction=0.7)[0] +
0.3 * hstab.aerodynamic_center(chord_fraction=0.7)[0] +