Skip to content

Commit

Permalink
Merge 0c52360 into 4f83c46
Browse files Browse the repository at this point in the history
  • Loading branch information
mclarke2 committed Jan 26, 2022
2 parents 4f83c46 + 0c52360 commit c5fe324
Show file tree
Hide file tree
Showing 41 changed files with 1,751 additions and 798 deletions.
2 changes: 1 addition & 1 deletion regression/automatic_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@
'scripts/sweeps/test_sweeps.py',
'scripts/test_input_output/test_xml_read_write.py',
'scripts/test_input_output/test_freemind_write.py',
'scripts/turboelectric_HTS_ducted_fan_network/turboelectric_HTS_ducted_fan_network.py',
'scripts/variable_cruise_distance/variable_cruise_distance.py',
'scripts/V_n_diagram/V_n_diagram_regression.py',
'scripts/VTOL/test_Multicopter.py',
'scripts/VTOL/test_Tiltwing.py',
'scripts/VTOL/test_Stopped_Rotor.py',
'scripts/weights/weights.py',
'scripts/turboelectric_HTS_ducted_fan_network/turboelectric_HTS_ducted_fan_network.py'
]

# ----------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions regression/scripts/VTOL/test_Stopped_Rotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ def base_analysis(vehicle):
energy.network = vehicle.networks
analyses.append(energy)


# ------------------------------------------------------------------
# Noise Analysis
noise = SUAVE.Analyses.Noise.Fidelity_One()
noise = SUAVE.Analyses.Noise.Fidelity_One()
noise.settings.level_ground_microphone_x_resolution = 2
noise.settings.level_ground_microphone_y_resolution = 2
noise.geometry = vehicle
analyses.append(noise)

Expand Down
28 changes: 13 additions & 15 deletions regression/scripts/Vehicles/Embraer_190.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,19 @@ def vehicle_setup():
# -----------------------------------------------------------------
# Design the Nacelle
# -----------------------------------------------------------------
nacelle = SUAVE.Components.Nacelles.Nacelle()
nacelle.diameter = 2.05
nacelle.length = 2.71
nacelle.tag = 'nacelle_1'
nacelle.inlet_diameter = 2.0
nacelle.origin = [[12.0,4.38,-2.1]]
Awet = 1.1*np.pi*nacelle.diameter*nacelle.length # 1.1 is simple coefficient
nacelle.areas.wetted = Awet
nacelle_airfoil = SUAVE.Components.Airfoils.Airfoil()
nacelle_airfoil.naca_4_series_airfoil = '2410'
nacelle.append_airfoil(nacelle_airfoil)

nacelle_2 = deepcopy(nacelle)
nacelle_2.tag = 'nacelle_2'
nacelle_2.origin = [[12.0,-4.38,-2.1]]
nacelle = SUAVE.Components.Nacelles.Nacelle()
nacelle.diameter = 2.05
nacelle.length = 2.71
nacelle.tag = 'nacelle_1'
nacelle.inlet_diameter = 2.0
nacelle.origin = [[12.0,4.38,-2.1]]
Awet = 1.1*np.pi*nacelle.diameter*nacelle.length # 1.1 is simple coefficient
nacelle.areas.wetted = Awet
nacelle.Airfoil.naca_4_series_airfoil = '2410'

nacelle_2 = deepcopy(nacelle)
nacelle_2.tag = 'nacelle_2'
nacelle_2.origin = [[12.0,-4.38,-2.1]]

vehicle.append_component(nacelle)
vehicle.append_component(nacelle_2)
Expand Down
2 changes: 1 addition & 1 deletion regression/scripts/Vehicles/Stopped_Rotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def vehicle_setup():
'../Vehicles/Airfoils/Polars/NACA_4412_polar_Re_1000000.txt' ]]

propeller.airfoil_polar_stations = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
propeller = propeller_design(propeller)
propeller = propeller_design(propeller,number_of_airfoil_section_points = 50)
propeller.origin = [[16.*0.3048 , 0. ,2.02*0.3048 ]]
net.propellers.append(propeller)

Expand Down
22 changes: 11 additions & 11 deletions regression/scripts/Vehicles/Tiltwing.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,12 @@ def configs_setup(vehicle):
config = SUAVE.Components.Configs.Config(base_config)
config.tag = 'hover'
vector_angle = 90.0 * Units.degrees
config.networks.battery_propeller.thrust_angle = vector_angle
config.networks.battery_propeller.thrust_angle = vector_angle
config.wings.main_wing.twists.root = vector_angle
config.wings.main_wing.twists.tip = vector_angle
config.wings.canard_wing.twists.root = vector_angle
config.wings.canard_wing.twists.tip = vector_angle
config.networks.battery_propeller.pitch_command = 0. * Units.degrees
config.networks.battery_propeller.pitch_command = 0. * Units.degrees
configs.append(config)

# ------------------------------------------------------------------
Expand All @@ -395,7 +395,7 @@ def configs_setup(vehicle):
config.wings.main_wing.twists.tip = vector_angle
config.wings.canard_wing.twists.root = vector_angle
config.wings.canard_wing.twists.tip = vector_angle
config.networks.battery_propeller.pitch_command = -5. * Units.degrees
config.networks.battery_propeller.pitch_command = -5. * Units.degrees
configs.append(config)

# ------------------------------------------------------------------
Expand All @@ -404,12 +404,12 @@ def configs_setup(vehicle):
config = SUAVE.Components.Configs.Config(base_config)
vector_angle = 45.0 * Units.degrees
config.tag = 'transition_seg_1_4'
config.networks.battery_propeller.thrust_angle = vector_angle
config.networks.battery_propeller.thrust_angle = vector_angle
config.wings.main_wing.twists.root = vector_angle
config.wings.main_wing.twists.tip = vector_angle
config.wings.canard_wing.twists.root = vector_angle
config.wings.canard_wing.twists.tip = vector_angle
config.networks.battery_propeller.pitch_command = 3. * Units.degrees
config.networks.battery_propeller.pitch_command = 3. * Units.degrees
configs.append(config)

# ------------------------------------------------------------------
Expand All @@ -418,12 +418,12 @@ def configs_setup(vehicle):
config = SUAVE.Components.Configs.Config(base_config)
config.tag = 'transition_seg_2_3'
vector_angle = 15.0 * Units.degrees
config.networks.battery_propeller.thrust_angle = vector_angle
config.networks.battery_propeller.thrust_angle = vector_angle
config.wings.main_wing.twists.root = vector_angle
config.wings.main_wing.twists.tip = vector_angle
config.wings.canard_wing.twists.root = vector_angle
config.wings.canard_wing.twists.tip = vector_angle
config.networks.battery_propeller.pitch_command = 5. * Units.degrees
config.networks.battery_propeller.pitch_command = 5. * Units.degrees
configs.append(config)

# ------------------------------------------------------------------
Expand All @@ -432,12 +432,12 @@ def configs_setup(vehicle):
config = SUAVE.Components.Configs.Config(base_config)
config.tag = 'cruise'
vector_angle = 0.0 * Units.degrees
config.networks.battery_propeller.thrust_angle = vector_angle
config.networks.battery_propeller.thrust_angle = vector_angle
config.wings.main_wing.twists.root = vector_angle
config.wings.main_wing.twists.tip = vector_angle
config.wings.canard_wing.twists.root = vector_angle
config.wings.canard_wing.twists.tip = vector_angle
config.networks.battery_propeller.pitch_command = 10. * Units.degrees
config.networks.battery_propeller.pitch_command = 10. * Units.degrees
configs.append(config)


Expand All @@ -448,12 +448,12 @@ def configs_setup(vehicle):
config = SUAVE.Components.Configs.Config(base_config)
config.tag = 'hover_descent'
vector_angle = 90.0 * Units.degrees
config.networks.battery_propeller.thrust_angle = vector_angle
config.networks.battery_propeller.thrust_angle = vector_angle
config.wings.main_wing.twists.root = vector_angle
config.wings.main_wing.twists.tip = vector_angle
config.wings.canard_wing.twists.root = vector_angle
config.wings.canard_wing.twists.tip = vector_angle
config.networks.battery_propeller.pitch_command = -5. * Units.degrees
config.networks.battery_propeller.pitch_command = -5. * Units.degrees
configs.append(config)

return configs
29 changes: 14 additions & 15 deletions regression/scripts/Vehicles/X57_Maxwell_Mod2.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,15 @@ def vehicle_setup():

# Component 2 the Propeller
prop = SUAVE.Components.Energy.Converters.Propeller()
prop.tag = 'propeller_1'
prop.number_of_blades = 2.0
prop.freestream_velocity = 135.*Units['mph']
prop.angular_velocity = 1300. * Units.rpm
prop.tip_radius = 76./2. * Units.inches
prop.hub_radius = 8. * Units.inches
prop.tag = 'propeller_1'
prop.number_of_blades = 3.0
prop.freestream_velocity = 150. * Units.knots
prop.angular_velocity = 2400. * Units.rpm
prop.tip_radius = 1.72/2
prop.hub_radius = 10. * Units.inches
prop.design_Cl = 0.8
prop.design_altitude = 12000. * Units.feet
prop.design_altitude = 12000. * Units.feet
prop.design_thrust = 1200.
prop.design_altitude = 9000. * Units.feet
prop.design_power = 98 * 0.65 * Units.hp # assume 65 BHP at crise
prop.origin = [[2.,2.5,0.784]]
prop.rotation = -1
prop.symmetry = True
Expand All @@ -438,7 +437,7 @@ def vehicle_setup():
'../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)
prop = propeller_design(prop,number_of_airfoil_section_points = 102)

prop_left = deepcopy(prop)
prop_left.tag = 'propeller_2'
Expand All @@ -452,7 +451,7 @@ def vehicle_setup():
# 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 = 500.
bat.max_voltage = 400.
initialize_from_mass(bat)
net.battery = bat
net.voltage = bat.max_voltage
Expand All @@ -465,10 +464,10 @@ def vehicle_setup():
motor = SUAVE.Components.Energy.Converters.Motor()
motor.efficiency = 0.95
motor.gearbox_efficiency = 1.
motor.origin = [[2., 2.5, 0.784]]
motor.nominal_voltage = bat.max_voltage *3/4
motor.origin = [[2., 2.5, 0.95]]
motor.nominal_voltage = bat.max_voltage*0.8
motor.propeller_radius = prop.tip_radius
motor.no_load_current = 4.0
motor.no_load_current = 0.1
motor = size_optimal_motor(motor,prop)
motor.mass_properties.mass = 10. * Units.kg

Expand All @@ -477,7 +476,7 @@ def vehicle_setup():

# append left motor
motor_left = deepcopy(motor)
motor_left.origin = [[2., -2.5, 0.784]]
motor_left.origin = [[2., -2.5, 0.95]]
net.propeller_motors.append(motor_left)

# Component 6 the Payload
Expand Down
12 changes: 6 additions & 6 deletions regression/scripts/battery/aircraft_discharge_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ def main():
# ----------------------------------------------------------------------

# General Aviation Aircraft
GA_RPM_true = [973.9534348587468,973.953434872128]
GA_lift_coefficient_true = [0.5474716962005756,0.5474716962005768]
GA_RPM_true = [2309.77190335992,2309.771903434153]
GA_lift_coefficient_true = [0.5474716961981719,0.5474716962462605]


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


Expand Down Expand Up @@ -321,7 +321,7 @@ def GA_mission_setup(analyses,vehicle):
segment.altitude_end = 8012 * Units.feet
segment.air_speed = 96.4260 * Units['mph']
segment.climb_rate = 700.034 * Units['ft/min']
segment = vehicle.networks.battery_propeller.add_unknowns_and_residuals_to_segment(segment)
segment = vehicle.networks.battery_propeller.add_unknowns_and_residuals_to_segment(segment, initial_power_coefficient = 0.005)

# add to misison
mission.append_segment(segment)
Expand All @@ -335,7 +335,7 @@ def GA_mission_setup(analyses,vehicle):
segment.altitude = 8012 * Units.feet
segment.air_speed = 120.91 * Units['mph']
segment.distance = 20. * Units.nautical_mile
segment = vehicle.networks.battery_propeller.add_unknowns_and_residuals_to_segment(segment)
segment = vehicle.networks.battery_propeller.add_unknowns_and_residuals_to_segment(segment, initial_power_coefficient = 0.005)

# add to misison
mission.append_segment(segment)
Expand All @@ -353,7 +353,7 @@ def GA_mission_setup(analyses,vehicle):
segment.air_speed_end = 110 * Units['mph']
segment.climb_rate = -200 * Units['ft/min']
segment.state.unknowns.throttle = 0.8 * ones_row(1)
segment = vehicle.networks.battery_propeller.add_unknowns_and_residuals_to_segment(segment, initial_power_coefficient = 0.1)
segment = vehicle.networks.battery_propeller.add_unknowns_and_residuals_to_segment(segment, initial_power_coefficient = 0.005)

# add to misison
mission.append_segment(segment)
Expand Down
24 changes: 13 additions & 11 deletions regression/scripts/electric_performance/electric_V_h_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from SUAVE.Methods.Performance.electric_V_h_diagram import electric_V_h_diagram

import numpy as np
import matplotlib.pyplot as plt

import sys
sys.path.append('../Vehicles')
Expand Down Expand Up @@ -61,25 +62,26 @@ def main():

climb_rate = electric_V_h_diagram(vehicle,
analyses,
CL_max=1.4,
delta_isa=0.,
grid_points=5,
altitude_ceiling= 2e4 * Units.ft,
max_speed=130 * Units['m/s'],
test_omega= 1000 * Units.rpm,
CL_max = 1.4,
delta_isa = 0.,
grid_points = 5,
altitude_ceiling= 1e4 * Units.ft,
max_speed = 150 * Units.knots,
test_omega = 2400 * Units.rpm,
display_plot=True)

climb_rate_r = [[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[719.7179757 , 582.17272069, 452.68248026, 329.12481042, 212.19190451],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]
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]])

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"

return

if __name__ == '__main__':
main()
plt.show()

print('Electric V_h Diagram Regression Passed.')
26 changes: 14 additions & 12 deletions regression/scripts/electric_performance/propeller_single_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from SUAVE.Core import Units, Data
from SUAVE.Methods.Performance.propeller_single_point import propeller_single_point
import matplotlib.pyplot as plt

import numpy as np

Expand Down Expand Up @@ -47,7 +48,7 @@ def test_1():
results = propeller_single_point(vehicle.networks.battery_propeller,
analyses,
pitch=0.,
omega=1500. * Units.rpm,
omega=2200. * Units.rpm,
altitude= 5000. * Units.ft,
delta_isa=0.,
speed=10 * Units['m/s'],
Expand All @@ -62,11 +63,11 @@ def test_1():
Cp = results.power_coefficient
etap = results.efficiency

thrust_r = 2301.918639576478
torque_r = 827.0007491838651
power_r = 129904.97390746429
Cp_r = 0.29381649996923126
etap_r = 0.17720005086702875
thrust_r = 643.8390579239042
torque_r = 130.76172993886766
power_r = 30125.33994408687
Cp_r = 0.03845761983322205
etap_r = 0.2137200971404406

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 @@ -92,7 +93,7 @@ def test_2():
results = propeller_single_point(vehicle.networks.battery_propeller,
analyses,
pitch=0.,
omega=1500. * Units.rpm,
omega=2200. * Units.rpm,
altitude= 5000. * Units.ft,
delta_isa=0.,
speed=10 * Units['m/s'],
Expand All @@ -107,11 +108,11 @@ def test_2():
Cp = results.power_coefficient
etap = results.efficiency

thrust_r = 2393.728639733924
torque_r = 855.298865633124
power_r = 134350.0316448353
Cp_r = 0.3038702436194616
etap_r = 0.17817105142646564
thrust_r = 594.5337489082791
torque_r = 129.9073779751413
power_r = 29928.511381546534
Cp_r = 0.03820635103278544
etap_r = 0.19865129318622227

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 @@ -123,5 +124,6 @@ def test_2():

if __name__ == '__main__':
main()
plt.show()

print('Propeller Single Point Regression Passed.')

0 comments on commit c5fe324

Please sign in to comment.