Skip to content

Commit

Permalink
Merge pull request #553 from suavecode/mfr1
Browse files Browse the repository at this point in the history
Feature - Multi Fidelity Rotors
  • Loading branch information
rachealerhard authored Feb 23, 2022
2 parents 01fba40 + c050355 commit 8cd11c1
Show file tree
Hide file tree
Showing 65 changed files with 2,794 additions and 1,802 deletions.
2 changes: 1 addition & 1 deletion regression/automatic_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
'scripts/aerodynamics/aerodynamics.py',
'scripts/aerodynamics/all_moving_surfaces_vlm.py',
'scripts/aerodynamics/control_surfaces_vlm.py',
'scripts/aerodynamics/sears_haack.py',
'scripts/aerodynamics/sideslip_and_rotation_vlm.py',
'scripts/airfoil_import/airfoil_import_test.py',
'scripts/airfoil_import/airfoil_interpolation_test.py',
Expand Down Expand Up @@ -98,7 +99,6 @@
'scripts/solar_network/solar_network.py',
'scripts/solar_network/solar_low_fidelity_network.py',
'scripts/solar_radiation/solar_radiation.py',
'scripts/aerodynamics/sears_haack.py',
'scripts/SU2_surrogate/BWB-450.py',
'scripts/sweeps/test_sweeps.py',
'scripts/test_input_output/test_xml_read_write.py',
Expand Down
7 changes: 4 additions & 3 deletions regression/scripts/VTOL/test_Stopped_Rotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def main():

# RPM of rotor check during hover
RPM = results.segments.climb_1.conditions.propulsion.lift_rotor_rpm[0][0]
RPM_true = 2383.999687566465
RPM_true = 2379.103576756637
print(RPM)
diff_RPM = np.abs(RPM - RPM_true)
print('RPM difference')
Expand All @@ -83,7 +83,7 @@ def main():

# Battery Energy Check During Transition
battery_energy_hover_to_transition = results.segments.transition_1.conditions.propulsion.battery_energy[:,0]
battery_energy_hover_to_transition_true = np.array([3.37412525e+08, 3.36777016e+08, 3.35686588e+08])
battery_energy_hover_to_transition_true = np.array([3.37413e+08, 3.36788424e+08, 3.35717487e+08])

print(battery_energy_hover_to_transition)
diff_battery_energy_hover_to_transition = np.abs(battery_energy_hover_to_transition - battery_energy_hover_to_transition_true)
Expand All @@ -93,7 +93,8 @@ def main():

# lift Coefficient Check During Cruise
lift_coefficient = results.segments.departure_terminal_procedures.conditions.aerodynamics.lift_coefficient[0][0]
lift_coefficient_true = 0.828126216785489
lift_coefficient_true = 0.828126216782719

print(lift_coefficient)
diff_CL = np.abs(lift_coefficient - lift_coefficient_true)
print('CL difference')
Expand Down
4 changes: 2 additions & 2 deletions regression/scripts/VTOL/test_Tiltwing.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def main():

# RPM check during hover
RPM = results.segments.departure.conditions.propulsion.propeller_rpm[0][0]
RPM_true = 1926.3247780885956
RPM_true = 1923.9312125560994

print(RPM)
diff_RPM = np.abs(RPM - RPM_true)
Expand All @@ -66,7 +66,7 @@ def main():

# lift Coefficient Check During Cruise
lift_coefficient = results.segments.climb.conditions.aerodynamics.lift_coefficient[0][0]
lift_coefficient_true = 1.0211063664785844
lift_coefficient_true = 1.0212057206343033
print(lift_coefficient)
diff_CL = np.abs(lift_coefficient - lift_coefficient_true)
print('CL difference')
Expand Down
4 changes: 0 additions & 4 deletions regression/scripts/aerodynamics/all_moving_surfaces_vlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,10 @@ def get_settings():
settings.fuselage_spanwise_vortices = 5
settings.fuselage_chordwise_vortices = 4

settings.use_bemt_wake_model = False
settings.propeller_wake_model = None
settings.spanwise_cosine_spacing = False
settings.model_fuselage = True
settings.model_nacelle = True
settings.initial_timestep_offset = 0.0
settings.wake_development_time = 0.0
settings.number_of_wake_timesteps = 0.0
settings.leading_edge_suction_multiplier = 1.
settings.discretize_control_surfaces = True
settings.use_VORLAX_matrix_calculation = False
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"CL": [[0.01303632226540534, 0.0780410573626043, 0.08248905189288461, 0.016307173337787927, 0.08046816835593676], [-0.12280800280115954, -0.04592298669153777, -0.04999506114878096, -0.1254051028118363, -0.05296625741450474], [0.04912493098494451, 0.09255608130455972, 0.1075096211822139, 0.054700993425594424, 0.14971352666893303]], "CDi": [[0.008104096290559342, 0.012727149234910983, 0.018952736758588794, 0.013183548116121385, 0.024520520747779936], [0.016592575893388188, 0.011505826257666116, 0.001980642088664995, 0.011622871434127819, 0.027175443805913618], [0.2246331961917148, 0.257472538914569, 0.20412475889176715, 0.193026307151546, 0.44408914603025695]], "CM": [[-0.018284513330272686, -0.04892740844355349, -0.05126973099370848, -0.019186687657053444, -0.05220550764642682], [0.06908307951073825, 0.02886236691848543, 0.0275834218401407, 0.06840124021230827, 0.04099747204243819], [0.1352027204556942, 0.10590173710795973, 0.08494657352158966, 0.12269027258944007, 0.07026519052968601]], "CYTOT": [[-0.10666129480336636, -0.06581979003155732, -0.1538020180892996, -0.16027917366616853, -0.052827042719840026], [0.1421546115040826, 0.1640003018520645, 0.08396991112488335, 0.0928576181736417, 0.1989422840320141], [0.34126906962326886, 0.3800530856031388, 0.2944196209550028, 0.2868711625016951, 0.46776750985850135]], "CRMTOT": [[-0.10663540428777263, -0.06671845794404414, -0.11965174645462061, -0.14412823378221268, -0.07148650084805372], [0.08803642391303193, 0.08193130033743604, 0.04230135725592372, 0.05979067924616201, 0.0998581901805158], [0.10263725669678857, 0.08585885446890208, 0.03879789799840028, 0.06822070897573455, 0.11053338185507396]], "CYMTOT": [[0.14898683356557005, 0.10590331132528157, 0.23531716985111253, 0.22519642518166946, 0.09478237901844565], [-0.20054745738611696, -0.23951751283204367, -0.12230503780054292, -0.13009657001517466, -0.3040266675936079], [-0.3181815909609861, -0.3847577906481167, -0.2549482213520731, -0.24028332684289339, -0.5118806961630608]]}
{"CL": [[0.013174649413627046, 0.07820203553128037, 0.08248905161420242, 0.01630717317435415, 0.08051736796385944], [-0.12279614560369596, -0.046040610477049375, -0.04999506092340315, -0.12540510267532834, -0.0529977953587301], [0.04928037746905511, 0.09274113581028637, 0.10750962025133681, 0.054700992543346476, 0.14976066298353388]], "CDi": [[0.00811257011091528, 0.012755626818117663, 0.018952736781923146, 0.013183548208167814, 0.024532425123235516], [0.0165914880232681, 0.01149588747020304, 0.0019806420461911858, 0.011622871272093818, 0.027159670525909903], [0.22463707681957515, 0.25756716365900645, 0.20412475992811327, 0.19302630817491542, 0.4441338541203386]], "CM": [[-0.018353479770695104, -0.048962065087908985, -0.05126973068354324, -0.019186687456270436, -0.05222056066347399], [0.06907917412492855, 0.02900114411233292, 0.027583421549531063, 0.06840123998650846, 0.04103130943340309], [0.1351191652845285, 0.10587961906787927, 0.08494657473349781, 0.1226902738462738, 0.07024269462580239]], "CYTOT": [[-0.10643794040648893, -0.06560547361385648, -0.15380201886564152, -0.1602791740788092, -0.05275083672912788], [0.14198527470643307, 0.16364450729840765, 0.08396991121856759, 0.09285761798001178, 0.19882028442599042], [0.3411513680281888, 0.37981702298294645, 0.29441962147611417, 0.2868711627151078, 0.4677032231771263]], "CRMTOT": [[-0.10646698758057352, -0.0666389353764613, -0.11965174677916234, -0.14412823397440425, -0.07145598895622893], [0.08794239840726326, 0.08171192035441284, 0.04230135767684419, 0.059790679695355724, 0.09978427590945359], [0.10245669236121806, 0.08546270341055404, 0.03879789826117672, 0.06822070902303752, 0.11042152627281036]], "CYMTOT": [[0.14867425438121123, 0.10560246359865026, 0.23531717092254656, 0.2251964256504412, 0.09467132822472744], [-0.20028472637280495, -0.23896835662390017, -0.12230503791950406, -0.1300965696769207, -0.3038260638078376], [-0.31800731398165405, -0.38431631614151096, -0.2549482218124662, -0.24028332690597418, -0.5117438492472138]]}
4 changes: 0 additions & 4 deletions regression/scripts/aerodynamics/control_surfaces_vlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,10 @@ def get_settings():
settings.fuselage_spanwise_vortices = 7
settings.fuselage_chordwise_vortices = 4

settings.use_bemt_wake_model = False
settings.propeller_wake_model = None
settings.spanwise_cosine_spacing = False
settings.model_fuselage = True
settings.model_nacelle = True
settings.initial_timestep_offset = 0.0
settings.wake_development_time = 0.0
settings.number_of_wake_timesteps = 0.0
settings.leading_edge_suction_multiplier = 1.
settings.discretize_control_surfaces = True

Expand Down
4 changes: 0 additions & 4 deletions regression/scripts/aerodynamics/sideslip_and_rotation_vlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,10 @@ def get_settings():
settings = SUAVE.Analyses.Aerodynamics.Vortex_Lattice().settings
settings.number_spanwise_vortices = 7
settings.number_chordwise_vortices = 4
settings.use_bemt_wake_model = False
settings.propeller_wake_model = None
settings.spanwise_cosine_spacing = False
settings.model_fuselage = True
settings.model_nacelle = False
settings.initial_timestep_offset = 0.0
settings.wake_development_time = 0.0
settings.number_of_wake_timesteps = 0.0
settings.leading_edge_suction_multiplier = 1.
settings.discretize_control_surfaces = False
settings.use_VORLAX_matrix_calculation = False
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"CL": [[-0.48628223328737097], [0.3130498924566126], [0.8525790400148388], [0.28906464635155305], [0.3288378077176768], [0.7015168883616248]], "CDi": [[0.013594744281976648], [0.002062284827339616], [0.03279432378682707], [-0.00376231705334241], [0.004791335634134629], [0.08690305924872999]], "CM": [[1.0085568916157734], [-0.2357995534653443], [-1.0488265228329599], [-0.17187458920323384], [-0.28181744087949434], [-0.9836505052663236]], "CYTOT": [[0.05693056256018248], [-0.03677214962638863], [-0.053304275188393105], [-0.06963518974758764], [0.008806457381872853], [-0.07218794666968248]], "CRTOT": [[-0.5297915783459537], [-0.22566809714650735], [-1.0578458308280867], [-0.14369479577974584], [-0.20030769787778588], [-0.7641876284536535]], "CRMTOT": [[0.015436817550872776], [0.006575410756017114], [0.030823013718767094], [0.004186911298943643], [0.00583647138338537], [0.02226653929060762]], "CNTOT": [[1.1009462438306568], [-0.7603218177624318], [-1.219930109917736], [-1.4077084095400634], [0.14554559979421894], [-1.3843961998168215]], "CYMTOT": [[-0.03207885325846902], [0.022153899118951974], [0.035545749123477154], [0.041017144800118394], [-0.004240839154843209], [0.040337884610047246]]}
{"CL": [[-0.4872864226956688], [0.31287070981475545], [0.8520268641219191], [0.28906464635159657], [0.32871036436177903], [0.701394813909725]], "CDi": [[0.013535788885322598], [0.0020757179561504014], [0.03289571120842621], [-0.003762317042422236], [0.004796954621319324], [0.0868974662215448]], "CM": [[1.01190372889708], [-0.23539139185634803], [-1.0475861915620868], [-0.17187458920256016], [-0.2813487558010326], [-0.9833173298934365]], "CYTOT": [[0.05716836393025687], [-0.03669597027479163], [-0.05317563445513884], [-0.06963518974852086], [0.008764793750749218], [-0.07212275974788764]], "CRTOT": [[-0.5099590337734], [-0.22151757637700453], [-1.0315566176890534], [-0.14369479577996777], [-0.19247428360424185], [-0.7576851839421325]], "CRMTOT": [[0.014858946205518649], [0.006454474836159805], [0.030057011004925797], [0.00418691129895011], [0.005608225046743643], [0.02207707412418801]], "CNTOT": [[1.1075618391052986], [-0.7581961539056747], [-1.2130468212403425], [-1.4077084094180918], [0.14574956029887703], [-1.3830573366477277]], "CYMTOT": [[-0.032271615358545995], [0.022091962526389123], [0.03534518709907758], [0.041017144796564445], [-0.00424678205999059], [0.04029887344544661]]}
10 changes: 6 additions & 4 deletions regression/scripts/battery/aircraft_discharge_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ def main():
# ----------------------------------------------------------------------

# General Aviation Aircraft
GA_RPM_true = [2309.77190335992,2309.771903434153]
GA_lift_coefficient_true = [0.5474716961981719,0.5474716962462605]

GA_RPM_true = [2309.141212595346,2309.14121251718]
GA_lift_coefficient_true = [0.547471696197573,0.547471696197573]


# EVTOL Aircraft
EVTOL_RPM_true = [2385.0695323649907,2385.0695327100425]
EVTOL_lift_coefficient_true = [0.8075122900985718,0.8075122900986484]
EVTOL_RPM_true = [2380.178696410079,2380.178696821923]

EVTOL_lift_coefficient_true = [0.8075115628618528,0.8075115628540404]


for i in range(len(battery_chemistry)):
Expand Down
12 changes: 7 additions & 5 deletions regression/scripts/electric_performance/electric_V_h_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ def main():
test_omega = 2400 * Units.rpm,
display_plot=True)

climb_rate_r = np.array([[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 690.77666187, 0. , 0. , 0. , 0. ],
[ 990.93245469, 891.48015277, 797.04295917, 707.15181814, 621.3124159 ],
[1119.13362839, 1010.88814744, 911.11133797, 818.81188384, 732.98273069]])

climb_rate_r = [[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 688.95379976, 0. , 0. , 0. , 0. ],
[ 988.57029452, 889.00719095, 794.54294615, 704.6958257 , 618.95691815 ],
[1122.48790477, 1014.18276964, 914.32071637, 821.89722234, 735.90126686]]


assert (np.all(np.nan_to_num(np.abs(climb_rate-climb_rate_r)/climb_rate_r) < 1e-6)), "Electric V_h Diagram Regression Failed"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def main():

payload_range = electric_payload_range(vehicle, mission, 'cruise', display_plot=True)

payload_range_r = [ 0. , 104044.1709376 , 110751.10559699]
payload_range_r = [ 0. , 104885.69625034908 , 111611.41071689726]

assert (np.abs(payload_range.range[1] - payload_range_r[1]) / payload_range_r[1] < 1e-6), "Payload Range Regression Failed at Max Payload Test"
assert (np.abs(payload_range.range[2] - payload_range_r[2]) / payload_range_r[2] < 1e-6), "Payload Range Regression Failed at Ferry Range Test"
Expand Down
38 changes: 21 additions & 17 deletions regression/scripts/electric_performance/propeller_single_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

from X57_Maxwell_Mod2 import vehicle_setup

from SUAVE.Analyses.Propulsion.Rotor_Wake_Fidelity_One import Rotor_Wake_Fidelity_One

#-------------------------------------------------------------------------------
# Test Function
#-------------------------------------------------------------------------------
Expand All @@ -34,9 +36,8 @@ def main():

def test_1():
"""
This tests the propeller_single_point function using the BEMT model.
This tests the propeller_single_point function using the Fidelity Zero rotor wake inflow model.
"""
HFW = False
vehicle = vehicle_setup()

analyses = SUAVE.Analyses.Vehicle()
Expand All @@ -53,21 +54,21 @@ def test_1():
delta_isa=0.,
speed=10 * Units['m/s'],
plots=True,
HFW=HFW,
print_results=True
)

thrust = results.thrust
torque = results.torque
power = results.power
Cp = results.power_coefficient
etap = results.efficiency

thrust_r = 643.8390579239042
torque_r = 130.76172993886766
power_r = 30125.33994408687
Cp_r = 0.03845761983322205
etap_r = 0.2137200971404406
thrust_r = 643.4365612076354
torque_r = 130.6985065893255
power_r = 30110.77432998669
Cp_r = 0.03843902555841082
etap_r = 0.21368980888905617


assert (np.abs(thrust - thrust_r) / thrust_r < 1e-6), "Propeller Single Point Regression Failed at Thrust Test"
assert (np.abs(torque - torque_r) / torque_r < 1e-6), "Propeller Single Point Regression Failed at Torque Test"
Expand All @@ -79,11 +80,14 @@ def test_1():

def test_2():
"""
This tests the propeller_single_point function using the helical fixed wake (HFW) + BET model.
This tests the propeller_single_point function using the Fidelity One rotor inflow model.
"""
HFW = True
vehicle = vehicle_setup()

# update the wake method used for each prop
for p in vehicle.networks.battery_propeller.propellers:
p.Wake = Rotor_Wake_Fidelity_One()

analyses = SUAVE.Analyses.Vehicle()
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmosphere.features.planet = SUAVE.Analyses.Planets.Planet()
Expand All @@ -98,7 +102,6 @@ def test_2():
delta_isa=0.,
speed=10 * Units['m/s'],
plots=True,
HFW=HFW,
print_results=True
)

Expand All @@ -108,11 +111,12 @@ def test_2():
Cp = results.power_coefficient
etap = results.efficiency

thrust_r = 594.5337489082791
torque_r = 129.9073779751413
power_r = 29928.511381546534
Cp_r = 0.03820635103278544
etap_r = 0.19865129318622227
thrust_r = 637.9402297052759
torque_r = 129.07946679553763
power_r = 29737.7743383709
Cp_r = 0.03796285858728355
etap_r = 0.21452184768317925


assert (np.abs(thrust - thrust_r) / thrust_r < 1e-6), "Propeller Single Point Regression Failed at Thrust Test"
assert (np.abs(torque - torque_r) / torque_r < 1e-6), "Propeller Single Point Regression Failed at Torque Test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def main():
# evaluate
results = mission.evaluate()

P_truth = 53963.82750731971
mdot_truth = 0.0047413854271471725
P_truth = 53734.90184388173
mdot_truth = 0.004721271494265418

P = results.segments.cruise.state.conditions.propulsion.power[-1,0]
mdot = results.segments.cruise.state.conditions.weights.vehicle_mass_rate[-1,0]
Expand Down
4 changes: 2 additions & 2 deletions regression/scripts/internal_combustion_propeller/ICE_Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def main():

h = 0.008757244664175039

P_truth = 53544.66503976736
mdot_truth = 0.00470455685313632
P_truth = 53254.6817133952
mdot_truth = 0.004679078254206552

P = results.segments.cruise.state.conditions.propulsion.power[-1,0]
mdot = results.segments.cruise.state.conditions.weights.vehicle_mass_rate[-1,0]
Expand Down
3 changes: 2 additions & 1 deletion regression/scripts/noise_fidelity_one/aircraft_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def main():

# SPL of rotor check during hover
print('\n\n SUAVE Frequency Domain Propeller Aircraft Noise Model')

X57_SPL = X57_results.segments.departure_end_of_runway.conditions.noise.total_SPL_dBA[0][0]
X57_SPL_true = 66.42462666684563
X57_SPL_true = 66.26047007599651

print(X57_SPL)
X57_diff_SPL = np.abs(X57_SPL - X57_SPL_true)
Expand Down
Loading

0 comments on commit 8cd11c1

Please sign in to comment.