/
Tiltrotor.py
533 lines (461 loc) · 24.6 KB
/
Tiltrotor.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
# Tiltrotor.py
#
# Created: Mar 2022, R. Erhard
""" setup file for a tiltrotor configuration based on the geometry of
the X57-Maxwell Modification 2 Electric Aircraft
"""
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
import SUAVE
from SUAVE.Core import Units
from SUAVE.Components.Energy.Networks.Battery_Propeller import Battery_Propeller
from SUAVE.Methods.Propulsion import propeller_design
from SUAVE.Methods.Power.Battery.Sizing import initialize_from_mass
from SUAVE.Methods.Propulsion.electric_motor_sizing import size_optimal_motor
from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_segmented_planform
import numpy as np
from copy import deepcopy
# ----------------------------------------------------------------------
# Define the Vehicle
# ----------------------------------------------------------------------
def vehicle_setup():
# ------------------------------------------------------------------
# Initialize the Vehicle
# ------------------------------------------------------------------
vehicle = SUAVE.Vehicle()
vehicle.tag = 'Tiltrotor'
# ------------------------------------------------------------------
# Vehicle-level Properties
# ------------------------------------------------------------------
vehicle.mass_properties.max_takeoff = 2550. * Units.pounds
vehicle.mass_properties.takeoff = 2550. * Units.pounds
vehicle.mass_properties.max_zero_fuel = 2550. * Units.pounds
vehicle.envelope.ultimate_load = 5.7
vehicle.envelope.limit_load = 3.8
vehicle.reference_area = 14.76
vehicle.passengers = 4
vehicle.systems.control = "fully powered"
vehicle.systems.accessories = "commuter"
cruise_speed = 135.*Units['mph']
altitude = 2500. * Units.ft
atmo = SUAVE.Analyses.Atmospheric.US_Standard_1976()
freestream = atmo.compute_values (0.)
freestream0 = atmo.compute_values (altitude)
mach_number = (cruise_speed/freestream.speed_of_sound)[0][0]
vehicle.design_dynamic_pressure = ( .5 *freestream0.density*(cruise_speed*cruise_speed))[0][0]
vehicle.design_mach_number = mach_number
# ------------------------------------------------------------------
# Main Wing
# ------------------------------------------------------------------
wing = SUAVE.Components.Wings.Main_Wing()
wing.tag = 'main_wing'
wing.sweeps.quarter_chord = 0.0 * Units.deg
wing.thickness_to_chord = 0.12
wing.areas.reference = 14.76
wing.spans.projected = 11.4
wing.chords.root = 1.46
wing.chords.tip = 0.92
wing.chords.mean_aerodynamic = 1.19
wing.taper = wing.chords.root/wing.chords.tip
wing.aspect_ratio = wing.spans.projected**2. / wing.areas.reference
wing.twists.root = 3.0 * Units.degrees
wing.twists.tip = 0.0 * Units.degrees
wing.origin = [[2.93, 0., 1.01]]
wing.aerodynamic_center = [3., 0., 1.01]
wing.vertical = False
wing.symmetric = True
wing.high_lift = True
wing.winglet_fraction = 0.0
wing.dynamic_pressure_ratio = 1.0
airfoil = SUAVE.Components.Airfoils.Airfoil()
airfoil.coordinate_file = '../Vehicles/Airfoils/NACA_63_412.txt'
cg_x = wing.origin[0][0] + 0.25*wing.chords.mean_aerodynamic
cg_z = wing.origin[0][2] - 0.2*wing.chords.mean_aerodynamic
vehicle.mass_properties.center_of_gravity = [[cg_x, 0. , cg_z ]] # SOURCE: Design and aerodynamic analysis of a twin-engine commuter aircraft
# Wing Segments
segment = SUAVE.Components.Wings.Segment()
segment.tag = 'inboard'
segment.percent_span_location = 0.0
segment.twist = 3. * Units.degrees
segment.root_chord_percent = 1.
segment.dihedral_outboard = 0.
segment.sweeps.quarter_chord = 0.
segment.thickness_to_chord = 0.12
segment.append_airfoil(airfoil)
wing.append_segment(segment)
segment = SUAVE.Components.Wings.Segment()
segment.tag = 'outboard'
segment.percent_span_location = 0.5438
segment.twist = 2.* Units.degrees
segment.root_chord_percent = 1.
segment.dihedral_outboard = 0.
segment.sweeps.quarter_chord = 0.
segment.thickness_to_chord = 0.12
segment.append_airfoil(airfoil)
wing.append_segment(segment)
segment = SUAVE.Components.Wings.Segment()
segment.tag = 'tip'
segment.percent_span_location = 1.
segment.twist = 0. * Units.degrees
segment.root_chord_percent = 0.630
segment.dihedral_outboard = 0.
segment.sweeps.quarter_chord = 0.
segment.thickness_to_chord = 0.12
segment.append_airfoil(airfoil)
wing.append_segment(segment)
# Fill out more segment properties automatically
wing = wing_segmented_planform(wing)
# add to vehicle
vehicle.append_component(wing)
# ------------------------------------------------------------------
# Horizontal Stabilizer
# ------------------------------------------------------------------
wing = SUAVE.Components.Wings.Wing()
wing.tag = 'horizontal_stabilizer'
wing.sweeps.quarter_chord = 0.0 * Units.deg
wing.thickness_to_chord = 0.12
wing.areas.reference = 2.540
wing.spans.projected = 3.3 * Units.meter
wing.sweeps.quarter_chord = 0 * Units.deg
wing.chords.root = 0.769 * Units.meter
wing.chords.tip = 0.769 * Units.meter
wing.chords.mean_aerodynamic = 0.769 * Units.meter
wing.taper = 1.
wing.aspect_ratio = wing.spans.projected**2. / wing.areas.reference
wing.twists.root = 0.0 * Units.degrees
wing.twists.tip = 0.0 * Units.degrees
wing.origin = [[7.7, 0., 0.25]]
wing.aerodynamic_center = [7.8, 0., 0.25]
wing.vertical = False
wing.winglet_fraction = 0.0
wing.symmetric = True
wing.high_lift = False
wing.dynamic_pressure_ratio = 0.9
# add to vehicle
vehicle.append_component(wing)
# ------------------------------------------------------------------
# Vertical Stabilizer
# ------------------------------------------------------------------
wing = SUAVE.Components.Wings.Wing()
wing.tag = 'vertical_stabilizer'
wing.sweeps.quarter_chord = 25. * Units.deg
wing.thickness_to_chord = 0.12
wing.areas.reference = 2.258 * Units['meters**2']
wing.spans.projected = 1.854 * Units.meter
wing.chords.root = 1.6764 * Units.meter
wing.chords.tip = 0.6858 * Units.meter
wing.chords.mean_aerodynamic = 1.21 * Units.meter
wing.taper = wing.chords.tip/wing.chords.root
wing.aspect_ratio = wing.spans.projected**2. / wing.areas.reference
wing.twists.root = 0.0 * Units.degrees
wing.twists.tip = 0.0 * Units.degrees
wing.origin = [[6.75 ,0, 0.623]]
wing.aerodynamic_center = [0.508 ,0,0]
wing.vertical = True
wing.symmetric = False
wing.t_tail = False
wing.winglet_fraction = 0.0
wing.dynamic_pressure_ratio = 1.0
# add to vehicle
vehicle.append_component(wing)
# ------------------------------------------------------------------
# Fuselage
# ------------------------------------------------------------------
fuselage = SUAVE.Components.Fuselages.Fuselage()
fuselage.tag = 'fuselage'
fuselage.seats_abreast = 2.
fuselage.fineness.nose = 1.6
fuselage.fineness.tail = 2.
fuselage.lengths.nose = 60. * Units.inches
fuselage.lengths.tail = 161. * Units.inches
fuselage.lengths.cabin = 105. * Units.inches
fuselage.lengths.total = 332.2* Units.inches
fuselage.lengths.fore_space = 0.
fuselage.lengths.aft_space = 0.
fuselage.width = 42. * Units.inches
fuselage.heights.maximum = 62. * Units.inches
fuselage.heights.at_quarter_length = 62. * Units.inches
fuselage.heights.at_three_quarters_length = 62. * Units.inches
fuselage.heights.at_wing_root_quarter_chord = 23. * Units.inches
fuselage.areas.side_projected = 8000. * Units.inches**2.
fuselage.areas.wetted = 30000. * Units.inches**2.
fuselage.areas.front_projected = 42.* 62. * Units.inches**2.
fuselage.effective_diameter = 50. * Units.inches
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_0'
segment.percent_x_location = 0
segment.percent_z_location = 0
segment.height = 0.01
segment.width = 0.01
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_1'
segment.percent_x_location = 0.007279116466
segment.percent_z_location = 0.002502014453
segment.height = 0.1669064748
segment.width = 0.2780205877
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_2'
segment.percent_x_location = 0.01941097724
segment.percent_z_location = 0.001216095397
segment.height = 0.3129496403
segment.width = 0.4365777215
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_3'
segment.percent_x_location = 0.06308567604
segment.percent_z_location = 0.007395489231
segment.height = 0.5841726619
segment.width = 0.6735119903
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_4'
segment.percent_x_location = 0.1653761217
segment.percent_z_location = 0.02891281352
segment.height = 1.064028777
segment.width = 1.067200529
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_5'
segment.percent_x_location = 0.2426372155
segment.percent_z_location = 0.04214148761
segment.height = 1.293766653
segment.width = 1.183058255
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_6'
segment.percent_x_location = 0.2960174029
segment.percent_z_location = 0.04705241831
segment.height = 1.377026712
segment.width = 1.181540054
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_7'
segment.percent_x_location = 0.3809404284
segment.percent_z_location = 0.05313580461
segment.height = 1.439568345
segment.width = 1.178218989
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_8'
segment.percent_x_location = 0.5046854083
segment.percent_z_location = 0.04655492473
segment.height = 1.29352518
segment.width = 1.054390707
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_9'
segment.percent_x_location = 0.6454149933
segment.percent_z_location = 0.03741966266
segment.height = 0.8971223022
segment.width = 0.8501926505
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_10'
segment.percent_x_location = 0.985107095
segment.percent_z_location = 0.04540283436
segment.height = 0.2920863309
segment.width = 0.2012565415
fuselage.Segments.append(segment)
# Segment
segment = SUAVE.Components.Lofted_Body_Segment.Segment()
segment.tag = 'segment_11'
segment.percent_x_location = 1
segment.percent_z_location = 0.04787575562
segment.height = 0.1251798561
segment.width = 0.1206021048
fuselage.Segments.append(segment)
# add to vehicle
vehicle.append_component(fuselage)
# ------------------------------------------------------------------
# Nacelles
# ------------------------------------------------------------------
nacelle = SUAVE.Components.Nacelles.Nacelle()
nacelle.tag = 'nacelle_1'
nacelle.length = 2.5
nacelle.diameter = 42 * Units.inches
nacelle.areas.wetted = 0.01*(2*np.pi*0.01/2)
nacelle.origin = [[2.,5.7,1.0]]
nacelle.flow_through = False
nac_segment = SUAVE.Components.Lofted_Body_Segment.Segment()
nac_segment.tag = 'segment_1'
nac_segment.percent_x_location = 0.0
nac_segment.height = 0.0
nac_segment.width = 0.0
nacelle.append_segment(nac_segment)
nac_segment = SUAVE.Components.Lofted_Body_Segment.Segment()
nac_segment.tag = 'segment_2'
nac_segment.percent_x_location = 0.1
nac_segment.height = 0.5
nac_segment.width = 0.65
nacelle.append_segment(nac_segment)
nac_segment = SUAVE.Components.Lofted_Body_Segment.Segment()
nac_segment.tag = 'segment_3'
nac_segment.percent_x_location = 0.3
nac_segment.height = 0.52
nac_segment.width = 0.7
nacelle.append_segment(nac_segment)
nac_segment = SUAVE.Components.Lofted_Body_Segment.Segment()
nac_segment.tag = 'segment_4'
nac_segment.percent_x_location = 0.5
nac_segment.height = 0.5
nac_segment.width = 0.65
nacelle.append_segment(nac_segment)
nac_segment = SUAVE.Components.Lofted_Body_Segment.Segment()
nac_segment.tag = 'segment_5'
nac_segment.percent_x_location = 0.7
nac_segment.height = 0.4
nac_segment.width = 0.6
nacelle.append_segment(nac_segment)
nac_segment = SUAVE.Components.Lofted_Body_Segment.Segment()
nac_segment.tag = 'segment_6'
nac_segment.percent_x_location = 0.9
nac_segment.height = 0.3
nac_segment.width = 0.5
nacelle.append_segment(nac_segment)
nac_segment = SUAVE.Components.Lofted_Body_Segment.Segment()
nac_segment.tag = 'segment_7'
nac_segment.percent_x_location = 1.0
nac_segment.height = 0.0
nac_segment.width = 0.0
nacelle.append_segment(nac_segment)
vehicle.append_component(nacelle)
nacelle_2 = deepcopy(nacelle)
nacelle_2.tag = 'nacelle_2'
nacelle_2.origin = [[2.,-5.7,1.0]]
vehicle.append_component(nacelle_2)
#---------------------------------------------------------------------------------------------
# DEFINE PROPELLER
#---------------------------------------------------------------------------------------------
# build network
net = Battery_Propeller()
net.number_of_propeller_engines = 2.
net.identical_propellers = True
# Component 1 the ESC
esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
esc.efficiency = 0.95 # Gundlach for brushless motors
net.esc = esc
Hover_Load = vehicle.mass_properties.takeoff * 9.81
# Component 2 the Propeller
prop = SUAVE.Components.Energy.Converters.Propeller()
prop.tag = 'propeller_1'
prop.tip_radius = 1.5
prop.number_of_blades = 3.0
prop.freestream_velocity = 90. * Units.mph
prop.design_tip_mach = 0.6
prop.angular_velocity = prop.design_tip_mach*340 /prop.tip_radius
prop.hub_radius = 0.15*prop.tip_radius
prop.design_Cl = 0.8
prop.design_altitude = 3000. * Units.feet
prop.design_thrust = (1.1*Hover_Load)/net.number_of_propeller_engines
prop.origin = [[2.,5.7,0.784]]
prop.rotation = -1
prop.sol_tolerance = 1e-4
prop.symmetry = True
prop.variable_pitch = True
prop.airfoil_geometry = ['../Vehicles/Airfoils/NACA_4412.txt']
prop.airfoil_polars = [['../Vehicles/Airfoils/Polars/NACA_4412_polar_Re_50000.txt' ,
'../Vehicles/Airfoils/Polars/NACA_4412_polar_Re_100000.txt' ,
'../Vehicles/Airfoils/Polars/NACA_4412_polar_Re_200000.txt' ,
'../Vehicles/Airfoils/Polars/NACA_4412_polar_Re_500000.txt' ,
'../Vehicles/Airfoils/Polars/NACA_4412_polar_Re_1000000.txt' ]]
prop.airfoil_polar_stations = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
prop = propeller_design(prop,number_of_airfoil_section_points = 102)
prop_left = deepcopy(prop)
prop_left.tag = 'propeller_2'
prop_left.origin = [[2.,-5.7,0.784]]
prop_left.rotation = 1
net.propellers.append(prop)
net.propellers.append(prop_left)
# Component 3 the Battery
bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion_LiNiMnCoO2_18650()
bat.mass_properties.mass = 500. * Units.kg
bat.max_voltage = 400.
initialize_from_mass(bat)
net.battery = bat
net.voltage = bat.max_voltage
# Component 4 Miscellaneous Systems
sys = SUAVE.Components.Systems.System()
sys.mass_properties.mass = 5 # kg
# Component 5 the Motor
motor = SUAVE.Components.Energy.Converters.Motor()
motor.efficiency = 0.95
motor.gearbox_efficiency = 1.
motor.origin = [[2., 5.7, 0.95]]
motor.nominal_voltage = bat.max_voltage*0.8
motor.propeller_radius = prop.tip_radius
motor.no_load_current = 0.1
motor = size_optimal_motor(motor,prop)
motor.mass_properties.mass = 10. * Units.kg
# append right motor
net.propeller_motors.append(motor)
# append left motor
motor_left = deepcopy(motor)
motor_left.origin = [[2., -5.7, 0.95]]
net.propeller_motors.append(motor_left)
# Component 6 the Payload
payload = SUAVE.Components.Energy.Peripherals.Payload()
payload.power_draw = 10. # Watts
payload.mass_properties.mass = 1.0 * Units.kg
net.payload = payload
# Component 7 the Avionics
avionics = SUAVE.Components.Energy.Peripherals.Avionics()
avionics.power_draw = 20. # Watts
net.avionics = avionics
# add the solar network to the vehicle
vehicle.append_component(net)
# ------------------------------------------------------------------
# Vehicle Definition Complete
# ------------------------------------------------------------------
return vehicle
# ---------------------------------------------------------------------
# Define the Configurations
# ---------------------------------------------------------------------
def configs_setup(vehicle):
# ------------------------------------------------------------------
# Initialize Configurations
# ------------------------------------------------------------------
configs = SUAVE.Components.Configs.Config.Container()
base_config = SUAVE.Components.Configs.Config(vehicle)
base_config.tag = 'base'
base_config.networks.battery_propeller.pitch_command = 0
configs.append(base_config)
# ------------------------------------------------------------------
# Hover Configuration
# ------------------------------------------------------------------
config = SUAVE.Components.Configs.Config(base_config)
config.tag = 'hover_climb'
vector_angle = 90.0 * Units.degrees
config.networks.battery_propeller.y_axis_rotation = vector_angle
config.networks.battery_propeller.pitch_command = 0. * Units.degrees
configs.append(config)
# ------------------------------------------------------------------
# Transition 1 Configuration
# ------------------------------------------------------------------
config = SUAVE.Components.Configs.Config(base_config)
config.tag = 'transition_1'
config.networks.battery_propeller.pitch_command = 0. * Units.degrees
configs.append(config)
# ------------------------------------------------------------------
# Cruise Configuration
# ------------------------------------------------------------------
config = SUAVE.Components.Configs.Config(base_config)
config.tag = 'cruise'
vector_angle = 0.0 * Units.degrees
config.networks.battery_propeller.y_axis_rotation = vector_angle
configs.append(config)
# done!
return configs