diff --git a/regression/scripts/AVL/avl_files/commands_01.deck b/regression/scripts/AVL/avl_files/commands_01.deck index 5ed71cdac5..6523f57d6c 100644 --- a/regression/scripts/AVL/avl_files/commands_01.deck +++ b/regression/scripts/AVL/avl_files/commands_01.deck @@ -3,6 +3,7 @@ mset 0 PLOP G + CASE batch_01.run OPER 1 diff --git a/regression/scripts/AVL/avl_files/commands_02.deck b/regression/scripts/AVL/avl_files/commands_02.deck index 7592f9b35f..b85cff5d06 100644 --- a/regression/scripts/AVL/avl_files/commands_02.deck +++ b/regression/scripts/AVL/avl_files/commands_02.deck @@ -3,6 +3,7 @@ mset 0 PLOP G + CASE batch_02.run OPER 1 diff --git a/regression/scripts/AVL/avl_files/commands_03.deck b/regression/scripts/AVL/avl_files/commands_03.deck index 52d390366e..a14848336f 100644 --- a/regression/scripts/AVL/avl_files/commands_03.deck +++ b/regression/scripts/AVL/avl_files/commands_03.deck @@ -3,6 +3,7 @@ mset 0 PLOP G + CASE batch_03.run OPER 1 diff --git a/regression/scripts/AVL/avl_files/commands_04.deck b/regression/scripts/AVL/avl_files/commands_04.deck index 9dc525cb76..758e2eb907 100644 --- a/regression/scripts/AVL/avl_files/commands_04.deck +++ b/regression/scripts/AVL/avl_files/commands_04.deck @@ -3,6 +3,7 @@ mset 0 PLOP G + CASE batch_04.run OPER 1 diff --git a/regression/scripts/AVL/avl_files/commands_05.deck b/regression/scripts/AVL/avl_files/commands_05.deck index 7a5c564ac0..0d0564edff 100644 --- a/regression/scripts/AVL/avl_files/commands_05.deck +++ b/regression/scripts/AVL/avl_files/commands_05.deck @@ -3,6 +3,7 @@ mset 0 PLOP G + CASE batch_05.run OPER 1 diff --git a/regression/scripts/AVL/avl_files/commands_06.deck b/regression/scripts/AVL/avl_files/commands_06.deck index 82ced6b75e..edc269c82f 100644 --- a/regression/scripts/AVL/avl_files/commands_06.deck +++ b/regression/scripts/AVL/avl_files/commands_06.deck @@ -3,6 +3,7 @@ mset 0 PLOP G + CASE batch_06.run OPER 1 diff --git a/regression/scripts/Vehicles/Boeing_737.py b/regression/scripts/Vehicles/Boeing_737.py index 4e5509a921..4625aab0f1 100644 --- a/regression/scripts/Vehicles/Boeing_737.py +++ b/regression/scripts/Vehicles/Boeing_737.py @@ -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() diff --git a/regression/scripts/solar_network/solar_network.py b/regression/scripts/solar_network/solar_network.py index 65798cb21e..fc86dfad8d 100644 --- a/regression/scripts/solar_network/solar_network.py +++ b/regression/scripts/solar_network/solar_network.py @@ -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) diff --git a/trunk/SUAVE/Analyses/Mission/Segments/Conditions/Aerodynamics.py b/trunk/SUAVE/Analyses/Mission/Segments/Conditions/Aerodynamics.py index d4977da7c7..b893a0337a 100644 --- a/trunk/SUAVE/Analyses/Mission/Segments/Conditions/Aerodynamics.py +++ b/trunk/SUAVE/Analyses/Mission/Segments/Conditions/Aerodynamics.py @@ -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 diff --git a/trunk/SUAVE/Components/Energy/Networks/Solar_Low_Fidelity.py b/trunk/SUAVE/Components/Energy/Networks/Solar_Low_Fidelity.py index d98ff6c6a6..52d7673f6f 100644 --- a/trunk/SUAVE/Components/Energy/Networks/Solar_Low_Fidelity.py +++ b/trunk/SUAVE/Components/Energy/Networks/Solar_Low_Fidelity.py @@ -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 @@ -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 diff --git a/trunk/SUAVE/Components/Energy/Storages/Batteries/Battery.py b/trunk/SUAVE/Components/Energy/Storages/Batteries/Battery.py index addb4cbee7..9ff5ad499b 100644 --- a/trunk/SUAVE/Components/Energy/Storages/Batteries/Battery.py +++ b/trunk/SUAVE/Components/Energy/Storages/Batteries/Battery.py @@ -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 diff --git a/trunk/SUAVE/Components/Energy/Storages/Batteries/Constant_Mass/Lithium_Ion.py b/trunk/SUAVE/Components/Energy/Storages/Batteries/Constant_Mass/Lithium_Ion.py index 6252408858..9d4dc07619 100644 --- a/trunk/SUAVE/Components/Energy/Storages/Batteries/Constant_Mass/Lithium_Ion.py +++ b/trunk/SUAVE/Components/Energy/Storages/Batteries/Constant_Mass/Lithium_Ion.py @@ -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 diff --git a/trunk/SUAVE/Components/Nacelles/Nacelle.py b/trunk/SUAVE/Components/Nacelles/Nacelle.py index 1c6b307726..dd15a1773f 100644 --- a/trunk/SUAVE/Components/Nacelles/Nacelle.py +++ b/trunk/SUAVE/Components/Nacelles/Nacelle.py @@ -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() diff --git a/trunk/SUAVE/Input_Output/OpenVSP/write_vsp_mesh.py b/trunk/SUAVE/Input_Output/OpenVSP/write_vsp_mesh.py index ae3fee526d..ac470973ed 100644 --- a/trunk/SUAVE/Input_Output/OpenVSP/write_vsp_mesh.py +++ b/trunk/SUAVE/Input_Output/OpenVSP/write_vsp_mesh.py @@ -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': diff --git a/trunk/SUAVE/Methods/Aerodynamics/AVL/write_input_deck.py b/trunk/SUAVE/Methods/Aerodynamics/AVL/write_input_deck.py index 3ae583ce63..18178d9264 100644 --- a/trunk/SUAVE/Methods/Aerodynamics/AVL/write_input_deck.py +++ b/trunk/SUAVE/Methods/Aerodynamics/AVL/write_input_deck.py @@ -33,6 +33,7 @@ def write_input_deck(avl_object,trim_aircraft): 0 PLOP G + ''' open_runs = \ '''CASE {} diff --git a/trunk/SUAVE/Methods/Geometry/Two_Dimensional/Cross_Section/Propulsion/compute_turbofan_geometry.py b/trunk/SUAVE/Methods/Geometry/Two_Dimensional/Cross_Section/Propulsion/compute_turbofan_geometry.py index f59272737f..6e17fc4f9a 100644 --- a/trunk/SUAVE/Methods/Geometry/Two_Dimensional/Cross_Section/Propulsion/compute_turbofan_geometry.py +++ b/trunk/SUAVE/Methods/Geometry/Two_Dimensional/Cross_Section/Propulsion/compute_turbofan_geometry.py @@ -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 \ No newline at end of file diff --git a/trunk/SUAVE/Plots/Geometry/plot_vehicle.py b/trunk/SUAVE/Plots/Geometry/plot_vehicle.py index 15c2c81eb0..9f880c9f81 100644 --- a/trunk/SUAVE/Plots/Geometry/plot_vehicle.py +++ b/trunk/SUAVE/Plots/Geometry/plot_vehicle.py @@ -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 diff --git a/trunk/SUAVE/Plots/Performance/Mission_Plots.py b/trunk/SUAVE/Plots/Performance/Mission_Plots.py index 44207900fb..e26de68b2e 100644 --- a/trunk/SUAVE/Plots/Performance/Mission_Plots.py +++ b/trunk/SUAVE/Plots/Performance/Mission_Plots.py @@ -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: @@ -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) @@ -451,10 +451,16 @@ 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) @@ -462,12 +468,15 @@ def plot_battery_pack_conditions(results, line_color = 'bo-', line_color2 = 'rs- 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: @@ -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) @@ -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) @@ -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: @@ -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) @@ -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: