Skip to content

Commit

Permalink
Merge branch 'develop' into feature-versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
planes authored Nov 9, 2021
2 parents 82096b7 + f233078 commit 411c734
Show file tree
Hide file tree
Showing 18 changed files with 107 additions and 62 deletions.
1 change: 1 addition & 0 deletions regression/scripts/AVL/avl_files/commands_01.deck
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mset
0
PLOP
G

CASE batch_01.run
OPER
1
Expand Down
1 change: 1 addition & 0 deletions regression/scripts/AVL/avl_files/commands_02.deck
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mset
0
PLOP
G

CASE batch_02.run
OPER
1
Expand Down
1 change: 1 addition & 0 deletions regression/scripts/AVL/avl_files/commands_03.deck
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mset
0
PLOP
G

CASE batch_03.run
OPER
1
Expand Down
1 change: 1 addition & 0 deletions regression/scripts/AVL/avl_files/commands_04.deck
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mset
0
PLOP
G

CASE batch_04.run
OPER
1
Expand Down
1 change: 1 addition & 0 deletions regression/scripts/AVL/avl_files/commands_05.deck
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mset
0
PLOP
G

CASE batch_05.run
OPER
1
Expand Down
1 change: 1 addition & 0 deletions regression/scripts/AVL/avl_files/commands_06.deck
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mset
0
PLOP
G

CASE batch_06.run
OPER
1
Expand Down
10 changes: 1 addition & 9 deletions regression/scripts/Vehicles/Boeing_737.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,18 +538,10 @@ def vehicle_setup():
turbofan.number_of_engines = 2.0
turbofan.bypass_ratio = 5.4
turbofan.engine_length = 2.71
turbofan.nacelle_diameter = 2.05

# This origin is overwritten by compute_component_centers_of_gravity(base,compute_propulsor_origin=True)
turbofan.origin = [[13.72, 4.86,-1.9],[13.72, -4.86,-1.9]]

#compute engine areas
Awet = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length

#Assign engine areas
turbofan.areas.wetted = Awet



# working fluid
turbofan.working_fluid = SUAVE.Attributes.Gases.Air()

Expand Down
2 changes: 1 addition & 1 deletion regression/scripts/solar_network/solar_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def main():
truth_F = 105.36115293829462
truth_rpm = 218.18739964349612
truth_i = 130.17994767726535
truth_bat = 136537368.1714456
truth_bat = 136584698.345862

print('battery energy')
print(energy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,10 @@ def __defaults__(self):
self.propulsion = Conditions()
self.propulsion.throttle = ones_1col * 0
self.propulsion.battery_energy = ones_1col * 0
self.propulsion.battery_voltage = ones_1col * 0
self.propulsion.battery_voltage_under_load = ones_1col * 0
self.propulsion.battery_voltage_open_circuit = ones_1col * 0
self.propulsion.battery_state_of_charge = ones_1col * 0
self.propulsion.thrust_breakdown = Conditions()
self.propulsion.voltage_under_load = ones_1col * 0
self.propulsion.voltage_open_circuit = ones_1col * 0
self.propulsion.battery_pack_temperature = ones_1col * 0
self.propulsion.battery_cell_temperature = ones_1col * 0
self.propulsion.battery_cell_charge_throughput = ones_1col * 0
Expand Down
21 changes: 12 additions & 9 deletions trunk/SUAVE/Components/Energy/Networks/Solar_Low_Fidelity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# package imports
import numpy as np
from .Network import Network
from SUAVE.Methods.Power.Battery.pack_battery_conditions import pack_battery_conditions

from SUAVE.Core import Data , Units

Expand Down Expand Up @@ -171,21 +172,23 @@ def evaluate_thrust(self,state):
battery.inputs = solar_logic.outputs
battery.energy_calc(numerics)

#Pack the conditions for outputs
# Calculate avionics and payload power
avionics_payload_power = avionics.outputs.power + payload.outputs.power

# Pack the conditions for outputs
a = conditions.freestream.speed_of_sound
R = propeller.tip_radius
rpm = motor.outputs.omega / Units.rpm
current = solar_logic.inputs.currentesc
battery_power_draw = battery.inputs.power_in
battery_energy = battery.current_energy
rpm = motor.outputs.omega / Units.rpm

battery.inputs.current = solar_logic.inputs.currentesc
pack_battery_conditions(conditions,battery,avionics_payload_power,P)

conditions.propulsion.solar_flux = solar_flux.outputs.flux
conditions.propulsion.propeller_rpm = rpm
conditions.propulsion.battery_current = current
conditions.propulsion.battery_power_draw = battery_power_draw
conditions.propulsion.battery_energy = battery_energy
conditions.propulsion.propeller_tip_mach = (R*rpm*Units.rpm)/a



#Create the outputs
F = num_engines * F * [1,0,0]
mdot = state.conditions.ones_row(1)*0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __defaults__(self):
self.initial_temperature = 20.0
self.current_capacitor_charge = 0.0
self.resistance = 0.07446 # base internal resistance of battery in ohms
self.specific_heat_capacity = 20.
self.specific_heat_capacity = 1100.
self.max_energy = 0.0
self.max_power = 0.0
self.max_voltage = 0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ def energy_calc(self,numerics,battery_discharge_flag= True):

# Compute state of charge and depth of discarge of the battery
initial_discharge_state = np.dot(I,P_bat) + E_current[0]
SOC_old = np.divide(initial_discharge_state,E_max)
SOC_old = np.divide(initial_discharge_state,E_max)

SOC_old[SOC_old>1] = 1.
SOC_old[SOC_old<0] = 0.

# Compute internal resistance
R_bat = -0.0169*(SOC_old**4) + 0.0418*(SOC_old**3) - 0.0273*(SOC_old**2) + 0.0069*(SOC_old) + 0.0043
Expand Down
2 changes: 1 addition & 1 deletion trunk/SUAVE/Components/Nacelles/Nacelle.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __defaults__(self):
self.orientation_euler_angles = [0.,0.,0.]
self.flow_through = True
self.differential_pressure = 0.0
self.Airfoil = Data()
self.Airfoil = Airfoil()
self.cowling_airfoil_angle = 0.0
self.Segments = ContainerOrdered()

Expand Down
2 changes: 2 additions & 0 deletions trunk/SUAVE/Input_Output/OpenVSP/write_vsp_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def set_sources(geometry):

for comp in components:
comp_name = vsp.GetGeomName(comp)
if comp_name not in comp_dict:
continue
comp_type = comp_type_dict[comp_name]
# Nacelle sources are not implemented
#if comp_name[0:8] == 'turbofan':
Expand Down
1 change: 1 addition & 0 deletions trunk/SUAVE/Methods/Aerodynamics/AVL/write_input_deck.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def write_input_deck(avl_object,trim_aircraft):
0
PLOP
G
'''
open_runs = \
'''CASE {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def compute_turbofan_geometry(turbofan, nacelle):
# pack
turbofan.engine_length = L_eng_m
turbofan.inlet_diameter = nacelle.diameter/np.sqrt(2.1)
nacelle.inlet_diameter = nacelle.diameter/np.sqrt(2.1)
nacelle.areas.wetted = 1.1*np.pi*nacelle.diameter*L_eng_m

return turbofan , nacelle
38 changes: 19 additions & 19 deletions trunk/SUAVE/Plots/Geometry/plot_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,25 +346,25 @@ def generate_nacelle_points(nac,tessellation = 24):

if num_nac_segs == 0:
num_nac_segs = int(n_points/2)
nac_pts = np.zeros((num_nac_segs,tessellation,3))
if nac.Airfoil:
for naf in nac.Airfoil:
if naf.naca_4_series_airfoil != None:
# use mean camber surface of airfoil
camber = float(naf.naca_4_series_airfoil[0])/100
camber_loc = float(naf.naca_4_series_airfoil[1])/10
thickness = float(naf.naca_4_series_airfoil[2:])/100
airfoil_data = compute_naca_4series(camber, camber_loc, thickness,(n_points - 2))
xpts = np.repeat(np.atleast_2d(airfoil_data.x_lower_surface).T,tessellation,axis = 1)*nac.length
zpts = np.repeat(np.atleast_2d(airfoil_data.camber_coordinates[0]).T,tessellation,axis = 1)*nac.length
elif naf.coordinate_file != None:
a_sec = naf.coordinate_file
a_secl = [0]
airfoil_data = import_airfoil_geometry(a_sec,npoints=num_nac_segs)
xpts = np.repeat(np.atleast_2d(np.take(airfoil_data.x_coordinates,a_secl,axis=0)).T,tessellation,axis = 1)*nac.length
zpts = np.repeat(np.atleast_2d(np.take(airfoil_data.y_coordinates,a_secl,axis=0)).T,tessellation,axis = 1)*nac.length
nac_pts = np.zeros((num_nac_segs,tessellation,3))
naf = nac.Airfoil

if naf.naca_4_series_airfoil != None:
# use mean camber surface of airfoil
camber = float(naf.naca_4_series_airfoil[0])/100
camber_loc = float(naf.naca_4_series_airfoil[1])/10
thickness = float(naf.naca_4_series_airfoil[2:])/100
airfoil_data = compute_naca_4series(camber, camber_loc, thickness,(n_points - 2))
xpts = np.repeat(np.atleast_2d(airfoil_data.x_lower_surface).T,tessellation,axis = 1)*nac.length
zpts = np.repeat(np.atleast_2d(airfoil_data.camber_coordinates[0]).T,tessellation,axis = 1)*nac.length

elif naf.coordinate_file != None:
a_sec = naf.coordinate_file
a_secl = [0]
airfoil_data = import_airfoil_geometry(a_sec,npoints=num_nac_segs)
xpts = np.repeat(np.atleast_2d(np.take(airfoil_data.x_coordinates,a_secl,axis=0)).T,tessellation,axis = 1)*nac.length
zpts = np.repeat(np.atleast_2d(np.take(airfoil_data.y_coordinates,a_secl,axis=0)).T,tessellation,axis = 1)*nac.length

else:
# if no airfoil defined, use super ellipse as default
a = nac.length/2
Expand Down
76 changes: 58 additions & 18 deletions trunk/SUAVE/Plots/Performance/Mission_Plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ def plot_battery_pack_conditions(results, line_color = 'bo-', line_color2 = 'rs-
results.segments.conditions.propulsion
battery_power_draw
battery_energy
voltage_under_load
voltage_open_circuit
battery_voltage_under_load
battery_voltage_open_circuit
current
Outputs:
Expand All @@ -417,11 +417,11 @@ def plot_battery_pack_conditions(results, line_color = 'bo-', line_color2 = 'rs-
pack_volts_oc = results.segments[i].conditions.propulsion.battery_voltage_open_circuit[:,0]
pack_current = results.segments[i].conditions.propulsion.battery_current[:,0]
pack_SOC = results.segments[i].conditions.propulsion.battery_state_of_charge[:,0]
pack_temp = results.segments[i].conditions.propulsion.battery_pack_temperature[:,0]
pack_current = results.segments[i].conditions.propulsion.battery_current[:,0]
pack_current = results.segments[i].conditions.propulsion.battery_current[:,0]

pack_battery_amp_hr = (pack_energy/ Units.Wh )/pack_volts
pack_C_rating = pack_current/pack_battery_amp_hr
pack_C_instant = pack_current/pack_battery_amp_hr
pack_C_nominal = pack_current/np.max(pack_battery_amp_hr)


axes = plt.subplot(3,3,1)
Expand Down Expand Up @@ -451,23 +451,32 @@ def plot_battery_pack_conditions(results, line_color = 'bo-', line_color2 = 'rs-
axes.legend(loc='upper right')

axes = plt.subplot(3,3,5)
axes.plot(time, pack_C_rating, line_color)
axes.set_xlabel('Time (mins)',axis_font)
axes.set_ylabel('C-Rate (C)',axis_font)
axes.set_ylabel('C-Rate (C)',axis_font)
set_axes(axes)
if i == 0:
axes.plot(time, pack_C_instant, line_color,label='Instantaneous')
axes.plot(time, pack_C_nominal, line_color2,label='Nominal')
else:
axes.plot(time, pack_C_instant, line_color)
axes.plot(time, pack_C_nominal, line_color2)
axes.legend(loc='upper right')

axes = plt.subplot(3,3,6)
axes.plot(time, pack_current, line_color)
axes.set_xlabel('Time (mins)',axis_font)
axes.set_ylabel('Current (A)',axis_font)
set_axes(axes)

axes = plt.subplot(3,3,7)
axes.plot(time, pack_temp, line_color)
axes.set_xlabel('Time (mins)',axis_font)
axes.set_ylabel('Temperature (K)',axis_font)
set_axes(axes)


# Set limits
for i in range(1,7):
ax = plt.subplot(3,3,i)
y_lo, y_hi = ax.get_ylim()
if y_lo>0: y_lo = 0
y_hi = y_hi*1.1
ax.set_ylim(y_lo,y_hi)


plt.tight_layout()
if save_figure:
Expand Down Expand Up @@ -520,7 +529,10 @@ def plot_battery_cell_conditions(results, line_color = 'bo-',line_color2 = 'rs--
cell_charge = results.segments[i].conditions.propulsion.battery_cell_charge_throughput[:,0]
cell_current = results.segments[i].conditions.propulsion.battery_cell_current[:,0]
cell_battery_amp_hr = (cell_energy/ Units.Wh )/cell_volts
cell_C_rating = cell_current/cell_battery_amp_hr

cell_battery_amp_hr = (cell_energy/ Units.Wh )/cell_volts
cell_C_instant = cell_current/cell_battery_amp_hr
cell_C_nominal = cell_current/np.max(cell_battery_amp_hr)


axes = plt.subplot(3,3,1)
Expand Down Expand Up @@ -552,10 +564,18 @@ def plot_battery_cell_conditions(results, line_color = 'bo-',line_color2 = 'rs--
axes.plot(time,cell_volts_oc, line_color2)

axes = plt.subplot(3,3,5)
axes.plot(time, cell_C_rating, line_color)
axes.set_ylabel('C-Rate (C)',axis_font)
set_axes(axes)

axes.set_xlabel('Time (mins)',axis_font)
axes.set_ylabel('C-Rate (C)',axis_font)
set_axes(axes)
if i == 0:
axes.plot(time, cell_C_instant, line_color,label='Instantaneous')
axes.plot(time, cell_C_nominal, line_color2,label='Nominal')
axes.legend(loc='upper right')
else:
axes.plot(time, cell_C_instant, line_color)
axes.plot(time, cell_C_nominal, line_color2)


axes = plt.subplot(3,3,6)
axes.plot(time, cell_charge, line_color)
axes.set_xlabel('Time (mins)',axis_font)
Expand All @@ -573,6 +593,15 @@ def plot_battery_cell_conditions(results, line_color = 'bo-',line_color2 = 'rs--
axes.set_xlabel('Time (mins)',axis_font)
axes.set_ylabel('Temperature (K)',axis_font)
set_axes(axes)


# Set limits
for i in range(1,9):
ax = plt.subplot(3,3,i)
y_lo, y_hi = ax.get_ylim()
if y_lo>0: y_lo = 0
y_hi = y_hi*1.1
ax.set_ylim(y_lo,y_hi)

plt.tight_layout()
if save_figure:
Expand Down Expand Up @@ -771,6 +800,7 @@ def plot_propeller_conditions(results, line_color = 'bo-', save_figure = False,
axes.plot(time, thrust, line_color)
axes.set_ylabel('Thrust (N)',axis_font)
set_axes(axes)


axes = plt.subplot(2,3,2)
axes.plot(time, rpm, line_color)
Expand Down Expand Up @@ -799,6 +829,16 @@ def plot_propeller_conditions(results, line_color = 'bo-', save_figure = False,
axes.set_xlabel('Time (mins)',axis_font)
axes.set_ylabel('Tip Mach',axis_font)
set_axes(axes)

# Set limits
for i in range(1,7):
ax = plt.subplot(2,3,i)
y_lo, y_hi = ax.get_ylim()
if y_lo>0: y_lo = 0
y_hi = y_hi*1.1
ax.set_ylim(y_lo,y_hi)



plt.tight_layout()
if save_figure:
Expand Down

0 comments on commit 411c734

Please sign in to comment.