Skip to content

Commit

Permalink
Merge fdd1143 into 9aaec3e
Browse files Browse the repository at this point in the history
  • Loading branch information
planes committed Jun 10, 2022
2 parents 9aaec3e + fdd1143 commit b708e59
Show file tree
Hide file tree
Showing 48 changed files with 1,350 additions and 961 deletions.
2 changes: 1 addition & 1 deletion regression/scripts/VTOL/test_Stopped_Rotor.py
Expand Up @@ -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.36372833e+08, 3.34188971e+08, 3.32108816e+08])
battery_energy_hover_to_transition_true = np.array([3.36372833e+08, 3.34117149e+08, 3.31634785e+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 Down
6 changes: 3 additions & 3 deletions regression/scripts/VTOL/test_Tiltwing.py
Expand Up @@ -39,12 +39,12 @@ def main():
print(configs.base.weight_breakdown)
print(configs.base.mass_properties.center_of_gravity)

# Plot vehicle
plot_vehicle(configs.cruise, save_figure = False, plot_control_points = False)

# evaluate mission
mission = analyses.missions.base
results = mission.evaluate()

# Plot vehicle
plot_vehicle(configs.cruise, save_figure = False, plot_control_points = False)

# plot results
plot_mission(results)
Expand Down
21 changes: 11 additions & 10 deletions regression/scripts/Vehicles/Electric_Multicopter.py
Expand Up @@ -230,16 +230,17 @@ def vehicle_setup():
Hover_Load = vehicle.mass_properties.takeoff*g # hover load
design_tip_mach = 0.7 # design tip mach number

lift_rotor = SUAVE.Components.Energy.Converters.Lift_Rotor()
lift_rotor.tip_radius = 3.95 * Units.feet
lift_rotor.hub_radius = 0.6 * Units.feet
lift_rotor.disc_area = np.pi*(lift_rotor.tip_radius**2)
lift_rotor.number_of_blades = 3
lift_rotor.freestream_velocity = 10.0
lift_rotor.angular_velocity = (design_tip_mach*speed_of_sound)/lift_rotor.tip_radius
lift_rotor.design_Cl = 0.7
lift_rotor.design_altitude = 1000 * Units.feet
lift_rotor.design_thrust = Hover_Load/(net.number_of_propeller_engines-1) # contingency for one-engine-inoperative condition
lift_rotor = SUAVE.Components.Energy.Converters.Lift_Rotor()
lift_rotor.tip_radius = 3.95 * Units.feet
lift_rotor.hub_radius = 0.6 * Units.feet
lift_rotor.disc_area = np.pi*(lift_rotor.tip_radius**2)
lift_rotor.number_of_blades = 3
lift_rotor.freestream_velocity = 10.0
lift_rotor.angular_velocity = (design_tip_mach*speed_of_sound)/lift_rotor.tip_radius
lift_rotor.design_Cl = 0.7
lift_rotor.design_altitude = 1000 * Units.feet
lift_rotor.design_thrust = Hover_Load/(net.number_of_propeller_engines-1) # contingency for one-engine-inoperative condition
lift_rotor.number_azimuthal_stations = 24

lift_rotor.airfoil_geometry = ['../Vehicles/Airfoils/NACA_4412.txt']
lift_rotor.airfoil_polars = [['../Vehicles/Airfoils/Polars/NACA_4412_polar_Re_50000.txt' ,
Expand Down
1 change: 1 addition & 0 deletions regression/scripts/Vehicles/X57_Maxwell_Mod2.py
Expand Up @@ -432,6 +432,7 @@ def vehicle_setup():
prop.rotation = -1
prop.symmetry = True
prop.variable_pitch = True
prop.number_azimuthal_stations = 24

prop.airfoil_geometry = [base + '/Airfoils/NACA_4412.txt']
prop.airfoil_polars = [[base + '/Airfoils/Polars/NACA_4412_polar_Re_50000.txt' ,
Expand Down
9 changes: 7 additions & 2 deletions regression/scripts/battery/aircraft_discharge_comparisons.py
Expand Up @@ -29,6 +29,11 @@
# ----------------------------------------------------------------------

def main():

# This is a local import because this test requires higher precision
from jax.config import config
config.update("jax_enable_x64", True)


battery_chemistry = ['NMC','LFP']
line_style_new = ['bo-','ro-','ko-']
Expand All @@ -40,12 +45,12 @@ def main():

# General Aviation Aircraft

GA_RPM_true = [2285.7997780675864,2285.799778062956]
GA_RPM_true = [2285.9153577168627,2285.915357533924]
GA_lift_coefficient_true = [0.547471696197573,0.547471696197573]


# EVTOL Aircraft
EVTOL_RPM_true = [2404.364318280946,2404.364318342303]
EVTOL_RPM_true = [2404.363170898832,2404.363170960121]

EVTOL_lift_coefficient_true = [0.8075309358242124,0.8075309358160647]

Expand Down
Expand Up @@ -35,7 +35,7 @@ def main():

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

payload_range_r = [ 0. , 105741.68756834493 , 112657.64879475858]
payload_range_r = [ 0. , 105501.80175599, 112440.05780817]

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
Expand Up @@ -46,8 +46,8 @@ def main():
# evaluate
results = mission.evaluate()

P_truth = 53595.149567238615
mdot_truth = 0.004708992539296991
P_truth = 53612.471034449656
mdot_truth = 0.00471051444306114

P = results.segments.cruise.state.conditions.propulsion.power[-1,0]
mdot = results.segments.cruise.state.conditions.weights.vehicle_mass_rate[-1,0]
Expand Down
6 changes: 2 additions & 4 deletions regression/scripts/internal_combustion_propeller/ICE_Test.py
Expand Up @@ -40,11 +40,9 @@ def main():

# evaluate
results = mission.evaluate()

h = 0.008757244664175039

P_truth = 53537.41049670278
mdot_truth = 0.0047039194523744885
P_truth = 53554.604136964546
mdot_truth = 0.004705430124970229

P = results.segments.cruise.state.conditions.propulsion.power[-1,0]
mdot = results.segments.cruise.state.conditions.weights.vehicle_mass_rate[-1,0]
Expand Down
Expand Up @@ -4,19 +4,15 @@
# Modified: Feb 2022, R. Erhard

import SUAVE
from SUAVE.Core import Units, Data
from SUAVE.Core import Units, Data, to_numpy
from SUAVE.Methods.Propulsion import propeller_design
from SUAVE.Plots.Performance.Propeller_Plots import *
from SUAVE.Methods.Aerodynamics.Common.Fidelity_Zero.Lift.compute_wing_wake import compute_wing_wake
from SUAVE.Methods.Aerodynamics.Common.Fidelity_Zero.Lift.compute_propeller_nonuniform_freestream import compute_propeller_nonuniform_freestream


from SUAVE.Analyses.Propulsion.Rotor_Wake_Fidelity_One import Rotor_Wake_Fidelity_One
import numpy as np
import pylab as plt



def main():
'''
This example shows a propeller operating in three cases of nonuniform freestream flow:
Expand Down Expand Up @@ -46,10 +42,10 @@ def case_1(vehicle, conditions):
prop = vehicle.networks.prop_net.propeller
prop.inputs.omega = np.ones_like(conditions.aerodynamics.angle_of_attack)*prop.angular_velocity
prop.orientation_euler_angles = [0.,20.*Units.degrees,0]
prop.use_2d_analysis = True
prop.number_azimuthal_stations = 24

# spin propeller in nonuniform flow
thrust, torque, power, Cp, outputs , etap = prop.spin(conditions)
thrust, torque, power, Cp, outputs , etap = to_numpy(prop.spin(conditions))

# plot velocities at propeller plane and resulting performance
plot_propeller_disc_performance(prop,outputs,title='Case 1: Operating at Thrust Angle')
Expand Down Expand Up @@ -98,7 +94,7 @@ def case_2(vehicle,conditions, Na=24, Nr=101):
prop.radial_velocities_2d = vr

# spin propeller in nonuniform flow
thrust, torque, power, Cp, outputs , etap = prop.spin(conditions)
thrust, torque, power, Cp, outputs , etap = to_numpy(prop.spin(conditions))

# plot velocities at propeller plane and resulting performance
plot_propeller_disc_performance(prop,outputs,title='Case 2: Arbitrary Freestream')
Expand Down Expand Up @@ -149,7 +145,7 @@ def case_3(vehicle,conditions):
#--------------------------------------------------------------------------------------
prop = compute_propeller_nonuniform_freestream(vehicle.networks.prop_net.propeller, wing_wake,conditions)
prop.nonuniform_freestream = True
thrust, torque, power, Cp, outputs , etap = prop.spin(conditions)
thrust, torque, power, Cp, outputs , etap = to_numpy(prop.spin(conditions))

thrust = np.linalg.norm(thrust)
thrust_r, torque_r, power_r, Cp_r, etap_r = 1670.6463962249322, 742.03161805, 101016.98013317, 0.46513985, 0.73932696
Expand Down Expand Up @@ -205,7 +201,7 @@ def test_conditions():
velocity_vector = np.zeros([len(aoa), 3])
velocity_vector[:, 0] = Vv
conditions.frames.inertial.velocity_vector = velocity_vector
conditions.propulsion.throttle = np.ones_like(velocity_vector)
conditions.propulsion.throttle = np.ones_like(conditions.freestream.density)

return conditions

Expand Down
47 changes: 28 additions & 19 deletions regression/scripts/propeller/propeller_test.py
Expand Up @@ -9,7 +9,7 @@
# ----------------------------------------------------------------------

import SUAVE
from SUAVE.Core import Units
from SUAVE.Core import Units, to_numpy
from SUAVE.Plots.Geometry import plot_propeller
import matplotlib.pyplot as plt
from SUAVE.Core import (
Expand All @@ -23,6 +23,11 @@

def main():

# This is a local import because this test requires higher precision
from jax.config import config
config.update("jax_enable_x64", True)


# This script could fail if either the design or analysis scripts fail,
# in case of failure check both. The design and analysis powers will
# differ because of karman-tsien compressibility corrections in the
Expand Down Expand Up @@ -111,6 +116,7 @@ def main():
prop.design_altitude = 1. * Units.km
prop.origin = [[16.*0.3048 , 0. ,2.02*0.3048 ]]
prop.design_power = gearbox.outputs.power
prop.number_azimuthal_stations= 1
prop = propeller_design(prop)

# Design a Rotor with airfoil geometry defined
Expand Down Expand Up @@ -156,7 +162,7 @@ def main():

# Find the operating conditions
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmosphere_conditions = atmosphere.compute_values(rot.design_altitude)
atmosphere_conditions = atmosphere.compute_values(rot.design_altitude)

V = prop.freestream_velocity
Vr = rot.freestream_velocity
Expand Down Expand Up @@ -186,47 +192,50 @@ def main():

# propeller with airfoil results
prop_a.inputs.pitch_command = 0.0*Units.degree
F_a, Q_a, P_a, Cplast_a ,output_a , etap_a = prop_a.spin(conditions)

F_a, Q_a, P_a, Cplast_a ,output_a , etap_a = to_numpy(prop_a.spin(conditions))
plot_results(output_a, prop_a,'blue','-','s')

# propeller without airfoil results
prop.inputs.pitch_command = 0.0*Units.degree
F, Q, P, Cplast ,output , etap = prop.spin(conditions)
F, Q, P, Cplast ,output , etap = to_numpy(prop.spin(conditions))
plot_results(output, prop,'red','-','o')



# rotor with airfoil results
rot_a.inputs.pitch_command = 0.0*Units.degree
Fr_a, Qr_a, Pr_a, Cplastr_a ,outputr_a , etapr = rot_a.spin(conditions_r)
Fr_a, Qr_a, Pr_a, Cplastr_a ,outputr_a , etapr = to_numpy(rot_a.spin(conditions_r))
plot_results(outputr_a, rot_a,'green','-','^')

# rotor with out airfoil results
rot.inputs.pitch_command = 0.0*Units.degree
Fr, Qr, Pr, Cplastr ,outputr , etapr = rot.spin(conditions_r)
Fr, Qr, Pr, Cplastr ,outputr , etapr = to_numpy(rot.spin(conditions_r))
plot_results(outputr, rot,'black','-','P')

# Truth values for propeller with airfoil geometry defined
F_a_truth = 3352.366469630676
Q_a_truth = 978.76113592
P_a_truth = 202761.72763161
F_a_truth = 3352.3664597724883
Q_a_truth = 978.76113388
P_a_truth = 202761.72720908
Cplast_a_truth = 0.10450832

# Truth values for propeller without airfoil geometry defined
F_truth = 2629.013537561697
F_truth = 2629.0135375646205
Q_truth = 787.38469662
P_truth = 163115.87734548
P_truth = 163115.87734575
Cplast_truth = 0.08407389

# Truth values for rotor with airfoil geometry defined
Fr_a_truth = 1499.6766372165007
Qr_a_truth = 139.1060306
Pr_a_truth = 28817.42853679
Cplastr_a_truth = 0.04532838
Fr_a_truth = 1579.2361899390073
Qr_a_truth = 146.35419614
Pr_a_truth = 30318.97014145
Cplastr_a_truth = 0.04769023

# Truth values for rotor without airfoil geometry defined
Fr_truth = 1250.1858821890885
Qr_truth = 121.95416738
Pr_truth = 25264.22102656
Cplastr_truth = 0.03973936
Fr_truth = 1321.2957050670902
Qr_truth = 128.70336151
Pr_truth = 26662.39491376
Cplastr_truth = 0.04193862

# Store errors
error = Data()
Expand Down
6 changes: 3 additions & 3 deletions regression/scripts/segments/transition_segment_test.py
Expand Up @@ -60,9 +60,9 @@ def main():


# Truth values
departure_throttle_truth = np.array([0.65161054, 0.65183868, 0.65231039, 0.65255397])
transition_1_throttle_truth = np.array([0.65434873, 0.64834806, 0.52075861, 0.58035428])
cruise_throttle_truth = np.array([0.46376169, 0.46409995, 0.4647782 , 0.4651182 ])
departure_throttle_truth = np.array([0.65161055, 0.65183868, 0.65231038, 0.65255396])
transition_1_throttle_truth = np.array([0.65310101, 0.65122118, 0.56863722, 0.58205937])
cruise_throttle_truth = np.array([0.46431766, 0.46465725, 0.46533815, 0.46567948])
transition_y_axis_rotations_truth = np.array([1.36961133, 1.34327318, 1.10250854, 0.06580108])

# Store errors
Expand Down
8 changes: 4 additions & 4 deletions regression/scripts/slipstream/propeller_interactions.py
Expand Up @@ -8,7 +8,7 @@
# ----------------------------------------------------------------------

import SUAVE
from SUAVE.Core import Units, Data
from SUAVE.Core import Units, Data, to_numpy

from SUAVE.Analyses.Propulsion.Rotor_Wake_Fidelity_One import Rotor_Wake_Fidelity_One
from SUAVE.Methods.Propulsion.Rotor_Wake.Fidelity_One.compute_wake_induced_velocity import compute_wake_induced_velocity
Expand Down Expand Up @@ -53,7 +53,7 @@ def main():
#--------------------------------------------------------------------

# run the BEVW for upstream isolated propeller
T_iso, Q_iso, P_iso, Cp_iso, outputs_iso , etap_iso = prop.spin(conditions)
T_iso, Q_iso, P_iso, Cp_iso, outputs_iso , etap_iso = to_numpy(prop.spin(conditions))

conditions.noise.sources.propellers[prop.tag] = outputs_iso

Expand All @@ -72,7 +72,7 @@ def main():
assert(abs(Cp_iso-Cp_iso_true)<1e-6)
assert(abs(etap_iso-etap_iso_true)<1e-6)

T_true, Q_true, P_true, Cp_true, etap_true = 3.4500540433063036,0.07229935,49.2126083,0.0459646,0.62679554
T_true, Q_true, P_true, Cp_true, etap_true = 3.4267339493649676,0.07226998,49.19261735,0.04594593,0.62281181

assert(abs(np.linalg.norm(T)-T_true)<1e-6)
assert(abs(Q-Q_true)<1e-6)
Expand All @@ -95,7 +95,7 @@ def run_downstream_propeller(prop, propeller_wake, conditions, plot_performance=
prop = compute_propeller_nonuniform_freestream(prop_copy, propeller_wake, conditions)

# run the propeller in this nonuniform flow
T, Q, P, Cp, outputs , etap = prop.spin(conditions)
T, Q, P, Cp, outputs , etap = to_numpy(prop.spin(conditions))

if plot_performance:
plot_propeller_disc_performance(prop,outputs)
Expand Down

0 comments on commit b708e59

Please sign in to comment.