diff --git a/B737_AVL_Tutorial/tut_mission_B737_AVL.py b/B737_AVL_Tutorial/tut_mission_B737_AVL.py index 80596b8..36d9d79 100644 --- a/B737_AVL_Tutorial/tut_mission_B737_AVL.py +++ b/B737_AVL_Tutorial/tut_mission_B737_AVL.py @@ -8,8 +8,11 @@ # SUAVE Imports import SUAVE +if not SUAVE.__version__=='2.5.0': + assert('These tutorials only work with the SUAVE 2.5.0 release') + from SUAVE.Core import Data, Units -from SUAVE.Plots.Mission_Plots import * +from SUAVE.Plots.Performance.Mission_Plots import * from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry from SUAVE.Input_Output.Results import print_parasite_drag, \ @@ -22,6 +25,8 @@ import numpy as np import pylab as plt +from copy import deepcopy + # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- @@ -116,7 +121,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Stability Analysis stability = SUAVE.Analyses.Stability.AVL() - stability.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY' + stability.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY' #stability.settings.spanwise_vortex_density = 3 stability.geometry = vehicle analyses.append(stability) @@ -124,7 +129,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Energy energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors + energy.network = vehicle.networks analyses.append(energy) # ------------------------------------------------------------------ @@ -304,6 +309,30 @@ def vehicle_setup(): # add to vehicle vehicle.append_component(fuselage) + + + # ------------------------------------------------------------------ + # Nacelles + # ------------------------------------------------------------------ + nacelle = SUAVE.Components.Nacelles.Nacelle() + nacelle.tag = 'nacelle_1' + nacelle.length = 2.71 + nacelle.inlet_diameter = 1.90 + nacelle.diameter = 2.05 + nacelle.areas.wetted = 1.1*np.pi*nacelle.diameter*nacelle.length + nacelle.origin = [[13.72, -4.86,-1.9]] + nacelle.flow_through = True + 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 = [[13.72, 4.86,-1.9]] + + vehicle.append_component(nacelle) + vehicle.append_component(nacelle_2) + # ------------------------------------------------------------------ # Turbofan Network @@ -316,13 +345,8 @@ def vehicle_setup(): # setup turbofan.number_of_engines = 2 turbofan.bypass_ratio = 5.4 - turbofan.engine_length = 2.71 * Units.meter - turbofan.nacelle_diameter = 2.05 * Units.meter turbofan.origin = [[13.72, 4.86,-1.9],[13.72, -4.86,-1.9]] - #compute engine areas - turbofan.areas.wetted = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length - # working fluid turbofan.working_fluid = SUAVE.Attributes.Gases.Air() diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index bb40957..9fbf1ad 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -8,6 +8,8 @@ # ---------------------------------------------------------------------- import SUAVE +if not SUAVE.__version__=='2.5.0': + assert('These tutorials only work with the SUAVE 2.5.0 release') import numpy as np import pylab as plt @@ -19,8 +21,12 @@ from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry +from SUAVE.Methods.Geometry.Two_Dimensional.Planform import segment_properties + +from SUAVE.Plots.Performance.Mission_Plots import * + +from copy import deepcopy -from SUAVE.Plots.Mission_Plots import * # ---------------------------------------------------------------------- # Main @@ -151,7 +157,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Energy energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors + energy.network = vehicle.networks analyses.append(energy) # ------------------------------------------------------------------ @@ -325,9 +331,23 @@ def vehicle_setup(): segment.sweeps.quarter_chord = 0. * Units.degrees segment.thickness_to_chord = 0.10 wing.Segments.append(segment) + + # Fill out more segment properties automatically + wing = segment_properties(wing) # add to vehicle vehicle.append_component(wing) + + # ------------------------------------------------------------------ + # Nacelle + # ------------------------------------------------------------------ + nacelle = SUAVE.Components.Nacelles.Nacelle() + nacelle.diameter = 3.96 * Units.meters + nacelle.length = 289. * Units.inches + nacelle.tag = 'nacelle' + nacelle.origin = [[123.0 *Units.feet, 25.0*Units.feet, 6.5*Units.feet]] + nacelle.Airfoil.naca_4_series_airfoil = '0012' + # ------------------------------------------------------------------ # Turbofan Network @@ -339,9 +359,6 @@ def vehicle_setup(): # setup turbofan.number_of_engines = 3.0 turbofan.bypass_ratio = 8.1 - turbofan.engine_length = 289. * Units.inches - turbofan.nacelle_diameter = 3.96 * Units.meters - #turbofan.cooling_ratio = 1.0 turbofan.origin = [[133.0 *Units.feet, 25.0*Units.feet, 6.5*Units.feet],[145.0 *Units.feet, 0.0*Units.feet, 6.5*Units.feet],[133.0 *Units.feet, -25.0*Units.feet, 6.5*Units.feet]] # working fluid @@ -481,19 +498,31 @@ def vehicle_setup(): #design sizing conditions altitude = 0. * Units.km mach_number = 0.01 - isa_deviation = 0. # add to network turbofan.thrust = thrust #size the turbofan turbofan_sizing(turbofan,mach_number,altitude) - #turbofan.size(mach_number,altitude) #computing the engine length and diameter - compute_turbofan_geometry(turbofan,None) + compute_turbofan_geometry(turbofan,nacelle) vehicle.append_component(turbofan) + + # Finish adding all the nacelles + + nacelle_2 = deepcopy(nacelle) + nacelle_2.tag = 'nacelle_2' + nacelle_2.origin = [[135.0 *Units.feet, 0.0*Units.feet, 6.5*Units.feet]] + + nacelle_3 = deepcopy(nacelle) + nacelle_3.tag = 'nacelle_3' + nacelle_3.origin = [[123.0 *Units.feet, -25.0*Units.feet, 6.5*Units.feet]] + + vehicle.append_component(nacelle) + vehicle.append_component(nacelle_2) + vehicle.append_component(nacelle_3) # ------------------------------------------------------------------ diff --git a/Regional_Jet_Optimization/Optimize.py b/Regional_Jet_Optimization/Optimize.py index 0240674..6c93e79 100644 --- a/Regional_Jet_Optimization/Optimize.py +++ b/Regional_Jet_Optimization/Optimize.py @@ -8,6 +8,8 @@ # ---------------------------------------------------------------------- import SUAVE +if not SUAVE.__version__=='2.5.0': + assert('These tutorials only work with the SUAVE 2.5.0 release') from SUAVE.Core import Units, Data import numpy as np import Vehicles diff --git a/Regional_Jet_Optimization/Plot_Mission.py b/Regional_Jet_Optimization/Plot_Mission.py index e11ff20..442793b 100644 --- a/Regional_Jet_Optimization/Plot_Mission.py +++ b/Regional_Jet_Optimization/Plot_Mission.py @@ -9,7 +9,7 @@ import SUAVE from SUAVE.Core import Units -from SUAVE.Plots.Mission_Plots import * +from SUAVE.Plots.Performance.Mission_Plots import * import pylab as plt # ---------------------------------------------------------------------- diff --git a/Regional_Jet_Optimization/Vehicles.py b/Regional_Jet_Optimization/Vehicles.py index 3a2bcbe..182164c 100644 --- a/Regional_Jet_Optimization/Vehicles.py +++ b/Regional_Jet_Optimization/Vehicles.py @@ -14,6 +14,8 @@ from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_planform +from copy import deepcopy + # ---------------------------------------------------------------------- # Define the Vehicle # ---------------------------------------------------------------------- @@ -196,33 +198,45 @@ def base_setup(): # add to vehicle vehicle.append_component(fuselage) + + + + # ----------------------------------------------------------------- + # 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]] + + vehicle.append_component(nacelle) + vehicle.append_component(nacelle_2) + # ------------------------------------------------------------------ # Turbofan Network # ------------------------------------------------------------------ - #initialize the gas turbine network gt_engine = SUAVE.Components.Energy.Networks.Turbofan() gt_engine.tag = 'turbofan' gt_engine.origin = [[12.0,4.38,-2.1],[12.0,-4.38,-2.1]] gt_engine.number_of_engines = 2.0 gt_engine.bypass_ratio = 5.4 - gt_engine.engine_length = 2.71 - gt_engine.nacelle_diameter = 2.05 - gt_engine.inlet_diameter = 2.0 - - #compute engine areas) - Awet = 1.1*np.pi*gt_engine.nacelle_diameter*gt_engine.engine_length # 1.1 is simple coefficient - - #Assign engine area - gt_engine.areas.wetted = Awet - - #set the working fluid for the network - working_fluid = SUAVE.Attributes.Gases.Air() #add working fluid to the network - gt_engine.working_fluid = working_fluid + gt_engine.working_fluid = SUAVE.Attributes.Gases.Air() #Component 1 : ram, to convert freestream static to stagnation quantities @@ -332,6 +346,7 @@ def base_setup(): fuel.mass_properties.mass = vehicle.mass_properties.max_takeoff-vehicle.mass_properties.max_fuel fuel.origin = vehicle.wings.main_wing.mass_properties.center_of_gravity fuel.mass_properties.center_of_gravity= vehicle.wings.main_wing.aerodynamic_center + # ------------------------------------------------------------------ # Vehicle Definition Complete # ------------------------------------------------------------------ diff --git a/Solar_UAV_Optimization/Analyses.py b/Solar_UAV_Optimization/Analyses.py index db002d2..2c48234 100644 --- a/Solar_UAV_Optimization/Analyses.py +++ b/Solar_UAV_Optimization/Analyses.py @@ -66,7 +66,7 @@ def base(vehicle): # Energy # ------------------------------------------------------------------ energy = SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors + energy.network = vehicle.networks analyses.append(energy) # ------------------------------------------------------------------ diff --git a/Solar_UAV_Optimization/Missions.py b/Solar_UAV_Optimization/Missions.py index 596274b..30a4939 100644 --- a/Solar_UAV_Optimization/Missions.py +++ b/Solar_UAV_Optimization/Missions.py @@ -55,7 +55,7 @@ def mission(analyses,vehicle): segment.analyses.extend(analyses.base) # segment attributes - segment.state.numerics.number_control_points = 50 + segment.state.numerics.number_control_points = 32 segment.dynamic_pressure = 115.0 * Units.pascals segment.start_time = time.strptime("Tue, Jun 21 11:00:00 2020", "%a, %b %d %H:%M:%S %Y",) segment.altitude = 1000.0 * Units.feet @@ -63,6 +63,7 @@ def mission(analyses,vehicle): segment.charge_ratio = 1.0 segment.latitude = 37.4 segment.longitude = -122.15 + segment.battery_energy = vehicle.base.networks.solar_low_fidelity.battery.max_energy segment.state.conditions.frames.wind.body_rotations[:,2] = 125.* Units.degrees mission.append_segment(segment) diff --git a/Solar_UAV_Optimization/Optimize.py b/Solar_UAV_Optimization/Optimize.py index f7477e5..468fc1e 100644 --- a/Solar_UAV_Optimization/Optimize.py +++ b/Solar_UAV_Optimization/Optimize.py @@ -7,6 +7,10 @@ # Imports # ---------------------------------------------------------------------- +import SUAVE +if not SUAVE.__version__=='2.5.0': + assert('These tutorials only work with the SUAVE 2.5.0 release') + from SUAVE.Core import Units, Data import numpy as np import Vehicles @@ -88,9 +92,9 @@ def setup(): [ 'wing_area' ,['vehicle_configurations.*.wings.main_wing.areas.reference', 'vehicle_configurations.base.reference_area'] ], [ 'aspect_ratio' , 'vehicle_configurations.*.wings.main_wing.aspect_ratio' ], - [ 'kv' , 'vehicle_configurations.*.propulsors.solar_low_fidelity.motor.speed_constant' ], - [ 'battery_mass' , 'vehicle_configurations.base.propulsors.solar_low_fidelity.battery.mass_properties.mass'], - [ 'solar_ratio' , 'vehicle_configurations.*.propulsors.solar_low_fidelity.solar_panel.ratio' ], + [ 'kv' , 'vehicle_configurations.*.networks.solar_low_fidelity.motor.speed_constant' ], + [ 'battery_mass' , 'vehicle_configurations.base.networks.solar_low_fidelity.battery.mass_properties.mass'], + [ 'solar_ratio' , 'vehicle_configurations.*.networks.solar_low_fidelity.solar_panel.ratio' ], [ 'dynamic_pressure' , 'missions.mission.segments.cruise.dynamic_pressure' ], [ 'Nothing' , 'summary.nothing' ], [ 'energy_constraint', 'summary.energy_constraint' ], diff --git a/Solar_UAV_Optimization/Plot_Mission.py b/Solar_UAV_Optimization/Plot_Mission.py index 9509f11..8ee9c43 100644 --- a/Solar_UAV_Optimization/Plot_Mission.py +++ b/Solar_UAV_Optimization/Plot_Mission.py @@ -7,7 +7,7 @@ # Imports # ---------------------------------------------------------------------- -from SUAVE.Plots.Mission_Plots import * +from SUAVE.Plots.Performance.Mission_Plots import * from SUAVE.Core import Units import pylab as plt @@ -20,7 +20,7 @@ def plot_mission(results,line_style='bo-'): plot_solar_flux(results) # Plot Aircraft Electronics - plot_electronic_conditions(results) + plot_battery_pack_conditions(results) return diff --git a/Solar_UAV_Optimization/Procedure.py b/Solar_UAV_Optimization/Procedure.py index 54dafa8..6b2723e 100644 --- a/Solar_UAV_Optimization/Procedure.py +++ b/Solar_UAV_Optimization/Procedure.py @@ -12,6 +12,7 @@ from SUAVE.Core import Units from SUAVE.Analyses.Process import Process from SUAVE.Methods.Power.Battery.Sizing import initialize_from_mass +from SUAVE.Methods.Power.Battery import append_initial_battery_conditions from SUAVE.Methods.Propulsion.electric_motor_sizing import size_from_kv # ---------------------------------------------------------------------- @@ -97,14 +98,14 @@ def simple_sizing(nexus): # Size solar panel area wing_area = vec.reference_area - spanel = vec.propulsors.solar_low_fidelity.solar_panel + spanel = vec.networks.solar_low_fidelity.solar_panel sratio = spanel.ratio solar_area = wing_area*sratio spanel.area = solar_area spanel.mass_properties.mass = solar_area*(0.60 * Units.kg) # Resize the motor - motor = vec.propulsors.solar_low_fidelity.motor + motor = vec.networks.solar_low_fidelity.motor motor = size_from_kv(motor) # diff the new data @@ -123,23 +124,22 @@ def weights_battery(nexus): config.weights.evaluate() vec = nexus.vehicle_configurations.base - payload = vec.propulsors.solar_low_fidelity.payload.mass_properties.mass - msolar = vec.propulsors.solar_low_fidelity.solar_panel.mass_properties.mass + payload = vec.networks.solar_low_fidelity.payload.mass_properties.mass + msolar = vec.networks.solar_low_fidelity.solar_panel.mass_properties.mass MTOW = vec.mass_properties.max_takeoff empty = vec.weight_breakdown.empty - mmotor = vec.propulsors.solar_low_fidelity.motor.mass_properties.mass + mmotor = vec.networks.solar_low_fidelity.motor.mass_properties.mass + segment = nexus.missions.mission.segments.cruise # Calculate battery mass batmass = MTOW - empty - payload - msolar -mmotor - bat = vec.propulsors.solar_low_fidelity.battery + bat = vec.networks.solar_low_fidelity.battery initialize_from_mass(bat,batmass) - vec.propulsors.solar_low_fidelity.battery.mass_properties.mass = batmass + vec.networks.solar_low_fidelity.battery.mass_properties.mass = batmass # Set Battery Charge - maxcharge = nexus.vehicle_configurations.base.propulsors.solar_low_fidelity.battery.max_energy - charge = maxcharge - - nexus.missions.mission.segments.cruise.battery_energy = charge + segment.battery_energy = bat.max_energy + append_initial_battery_conditions(segment, bat) return nexus @@ -165,7 +165,7 @@ def post_process(nexus): res = nexus.results.mission.segments.cruise.conditions # Final Energy - maxcharge = vec.propulsors.solar_low_fidelity.battery.max_energy + maxcharge = vec.networks.solar_low_fidelity.battery.max_energy # Energy constraints, the battery doesn't go to zero anywhere, using a P norm p = 8. diff --git a/Solar_UAV_Optimization/Vehicles.py b/Solar_UAV_Optimization/Vehicles.py index 3a06298..cbbc715 100644 --- a/Solar_UAV_Optimization/Vehicles.py +++ b/Solar_UAV_Optimization/Vehicles.py @@ -141,6 +141,16 @@ def base_setup(): # add to vehicle vehicle.append_component(wing) + + # ------------------------------------------------------------------ + # Nacelle + # ------------------------------------------------------------------ + nacelle = SUAVE.Components.Nacelles.Nacelle() + nacelle.diameter = 0.05 * Units.meters + nacelle.length = 0.01 * Units.meters + nacelle.tag = 'nacelle' + nacelle.areas.wetted = nacelle.length *(2*np.pi*nacelle.diameter/2.) + vehicle.append_component(nacelle) #------------------------------------------------------------------ # Propulsor @@ -149,10 +159,6 @@ def base_setup(): # build network net = Solar_Low_Fidelity() net.number_of_engines = 1. - net.nacelle_diameter = 0.05 - net.areas = Data() - net.areas.wetted = 0.01*(2*np.pi*0.01/2) - net.engine_length = 0.01 # Component 1 the Sun sun = SUAVE.Components.Energy.Processes.Solar_Radiation() diff --git a/tut_concorde.py b/tut_concorde.py index 39ae55b..a17b34f 100644 --- a/tut_concorde.py +++ b/tut_concorde.py @@ -12,13 +12,18 @@ # ---------------------------------------------------------------------- import SUAVE +if not SUAVE.__version__=='2.5.0': + assert('These tutorials only work with the SUAVE 2.5.0 release') + from SUAVE.Core import Units, Data -from SUAVE.Plots.Mission_Plots import * +from SUAVE.Plots.Performance.Mission_Plots import * from SUAVE.Methods.Propulsion.turbojet_sizing import turbojet_sizing import numpy as np import pylab as plt +from copy import deepcopy + # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- @@ -120,7 +125,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Energy energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors #what is called throughout the mission (at every time step)) + energy.network = vehicle.networks #what is called throughout the mission (at every time step)) analyses.append(energy) # ------------------------------------------------------------------ @@ -260,6 +265,35 @@ def vehicle_setup(): # add to vehicle vehicle.append_component(fuselage) + + # ------------------------------------------------------------------ + # the nacelle + # ------------------------------------------------------------------ + + nacelle = SUAVE.Components.Nacelles.Nacelle() + nacelle.diameter = 1.3 + nacelle.tag = 'nacelle_L1' + nacelle.origin = [[36.56, 22, -1.9]] + nacelle.length = 12.0 + nacelle.inlet_diameter = 1.1 + nacelle.areas.wetted = 30. + vehicle.append_component(nacelle) + + nacelle_2 = deepcopy(nacelle) + nacelle_2.tag = 'nacelle_2' + nacelle_2.origin = [[37.,5.3,-1.3]] + vehicle.append_component(nacelle_2) + + nacelle_3 = deepcopy(nacelle) + nacelle_3.tag = 'nacelle_3' + nacelle_3.origin = [[37.,-5.3,-1.3]] + vehicle.append_component(nacelle_3) + + nacelle_4 = deepcopy(nacelle) + nacelle_4.tag = 'nacelle_4' + nacelle_4.origin = [[37.,-6.,-1.3]] + vehicle.append_component(nacelle_4) + # ------------------------------------------------------------------ # Turbojet Network @@ -272,10 +306,6 @@ def vehicle_setup(): # setup turbojet.number_of_engines = 4.0 turbojet.engine_length = 12.0 - turbojet.nacelle_diameter = 1.3 * Units.meter - turbojet.inlet_diameter = 1.1 * Units.meter - turbojet.areas = Data() - turbojet.areas.wetted = 12.5*4.7*2. * Units['meter**2'] # 4.7 is outer perimeter on one side turbojet.origin = [[37.,6.,-1.3],[37.,5.3,-1.3],[37.,-5.3,-1.3],[37.,-6.,-1.3]] # meters # working fluid diff --git a/tut_mission_B737.py b/tut_mission_B737.py index 7a86926..d04a77a 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -19,6 +19,8 @@ # SUAVE Imports import SUAVE +if not SUAVE.__version__=='2.5.0': + assert('These tutorials only work with the SUAVE 2.5.0 release') from SUAVE.Core import Data, Units # The Data import here is a native SUAVE data structure that functions similarly to a dictionary. # However, iteration directly returns values, and values can be retrieved either with the @@ -28,13 +30,14 @@ # This is because SUAVE functions generally operate using metric units, so inputs must be # converted. To use a length of 20 feet, set l = 20 * Units.ft . Additionally, to convert to SUAVE # output back to a desired units, use l_ft = l_m / Units.ft -from SUAVE.Plots.Mission_Plots import * +from SUAVE.Plots.Performance.Mission_Plots import * # These are a variety of plotting routines that simplify the plotting process for commonly # requested metrics. Plots of specifically desired metrics can also be manually created. from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing # Rather than conventional sizing, this script builds the turbofan energy network. This process is # covered in more detail in a separate tutorial. It does not size the turbofan geometry. +from copy import deepcopy # ---------------------------------------------------------------------- # Main @@ -139,8 +142,8 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Energy - energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors + energy = SUAVE.Analyses.Energy.Energy() + energy.network = vehicle.networks analyses.append(energy) # ------------------------------------------------------------------ @@ -394,6 +397,30 @@ def vehicle_setup(): # add to vehicle vehicle.append_component(fuselage) + + + # ------------------------------------------------------------------ + # Nacelles + # ------------------------------------------------------------------ + nacelle = SUAVE.Components.Nacelles.Nacelle() + nacelle.tag = 'nacelle_1' + nacelle.length = 2.71 + nacelle.inlet_diameter = 1.90 + nacelle.diameter = 2.05 + nacelle.areas.wetted = 1.1*np.pi*nacelle.diameter*nacelle.length + nacelle.origin = [[13.72, -4.86,-1.9]] + nacelle.flow_through = True + 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 = [[13.72, 4.86,-1.9]] + + vehicle.append_component(nacelle) + vehicle.append_component(nacelle_2) + # ------------------------------------------------------------------ # Turbofan Network @@ -407,17 +434,11 @@ def vehicle_setup(): # High-level setup turbofan.number_of_engines = 2 turbofan.bypass_ratio = 5.4 - turbofan.engine_length = 2.71 * Units.meter - turbofan.nacelle_diameter = 2.05 * Units.meter turbofan.origin = [[13.72, 4.86,-1.9],[13.72, -4.86,-1.9]] * Units.meter - - # Approximate the wetted area - turbofan.areas.wetted = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length - + # Establish the correct working fluid turbofan.working_fluid = SUAVE.Attributes.Gases.Air() - # Components use estimated efficiencies. Estimates by technology level can be # found in textbooks such as those by J.D. Mattingly diff --git a/tut_payload_range.py b/tut_payload_range.py index 40fb26c..2bc80a9 100644 --- a/tut_payload_range.py +++ b/tut_payload_range.py @@ -9,15 +9,18 @@ # ---------------------------------------------------------------------- import SUAVE +if not SUAVE.__version__=='2.5.0': + assert('These tutorials only work with the SUAVE 2.5.0 release') from SUAVE.Core import Units, Data from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing from SUAVE.Methods.Performance import payload_range from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_planform -from SUAVE.Plots.Mission_Plots import * +from SUAVE.Plots.Performance.Mission_Plots import * import numpy as np import pylab as plt + # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- @@ -126,7 +129,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Propulsion Analysis energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors + energy.network = vehicle.networks analyses.append(energy) # ------------------------------------------------------------------ @@ -332,21 +335,9 @@ def vehicle_setup(): gt_engine.origin = [[12.0,4.38,-2.1],[12.0,-4.38,-2.1]] gt_engine.number_of_engines = 2.0 gt_engine.bypass_ratio = 5.4 - gt_engine.engine_length = 2.71 - gt_engine.nacelle_diameter = 2.05 - gt_engine.inlet_diameter = 2.0 - - #compute engine areas) - Amax = (np.pi/4.)*gt_engine.nacelle_diameter**2. - Awet = 1.1*np.pi*gt_engine.nacelle_diameter*gt_engine.engine_length # 1.1 is simple coefficient - #Assign engine area - gt_engine.areas.wetted = Awet - #set the working fluid for the network - working_fluid = SUAVE.Attributes.Gases.Air() #add working fluid to the network - gt_engine.working_fluid = working_fluid - + gt_engine.working_fluid = SUAVE.Attributes.Gases.Air() #Component 1 : ram, to convert freestream static to stagnation quantities ram = SUAVE.Components.Energy.Converters.Ram() diff --git a/tut_solar_uav.py b/tut_solar_uav.py index baf87f9..f938839 100644 --- a/tut_solar_uav.py +++ b/tut_solar_uav.py @@ -7,17 +7,20 @@ # Imports # ---------------------------------------------------------------------- import SUAVE -from SUAVE.Core import Units, Data +if not SUAVE.__version__=='2.5.0': + assert('These tutorials only work with the SUAVE 2.5.0 release') +from SUAVE.Core import Units import numpy as np import pylab as plt import time -from SUAVE.Plots.Mission_Plots import * +from SUAVE.Plots.Performance.Mission_Plots import * from SUAVE.Components.Energy.Networks.Solar import Solar from SUAVE.Methods.Propulsion import propeller_design from SUAVE.Methods.Power.Battery.Sizing import initialize_from_mass + # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- @@ -192,6 +195,18 @@ def vehicle_setup(): # add to vehicle vehicle.append_component(wing) + + # ------------------------------------------------------------------ + # Nacelle + # ------------------------------------------------------------------ + nacelle = SUAVE.Components.Nacelles.Nacelle() + nacelle.diameter = 0.2 * Units.meters + nacelle.length = 0.01 * Units.meters + nacelle.tag = 'nacelle' + nacelle.areas.wetted = nacelle.length *(2*np.pi*nacelle.diameter/2.) + vehicle.append_component(nacelle) + + #------------------------------------------------------------------ # Propulsor #------------------------------------------------------------------ @@ -199,11 +214,7 @@ def vehicle_setup(): # build network net = Solar() net.number_of_engines = 1. - net.nacelle_diameter = 0.2 * Units.meters - net.engine_length = 0.01 * Units.meters - net.areas = Data() - net.areas.wetted = 0.01*(2*np.pi*0.01/2.) - + # Component 1 the Sun? sun = SUAVE.Components.Energy.Processes.Solar_Radiation() net.solar_flux = sun @@ -229,25 +240,25 @@ def vehicle_setup(): prop.tip_radius = 4.25 * Units.meters prop.hub_radius = 0.05 * Units.meters prop.design_Cl = 0.7 - prop.design_altitude = 14.0 * Units.km - prop.design_thrust = None - prop.design_power = 3500.0 * Units.watts + prop.design_altitude = 15.0 * Units.km + prop.design_power = None + prop.design_thrust = 120. prop = propeller_design(prop) - net.propeller = prop + net.propellers.append(prop) # Component 4 the Motor motor = SUAVE.Components.Energy.Converters.Motor() - motor.resistance = 0.008 - motor.no_load_current = 4.5 * Units.ampere - motor.speed_constant = 120. * Units['rpm'] # RPM/volt converted to (rad/s)/volt + motor.resistance = 0.006 + motor.no_load_current = 2.5 * Units.ampere + motor.speed_constant = 30. * Units['rpm'] # RPM/volt converted to (rad/s)/volt motor.propeller_radius = prop.tip_radius motor.propeller_Cp = prop.design_power_coefficient motor.gear_ratio = 12. # Gear ratio motor.gearbox_efficiency = .98 # Gear box efficiency - motor.expected_current = 160. # Expected current + motor.expected_current = 60. # Expected current motor.mass_properties.mass = 2.0 * Units.kg - net.motor = motor + net.motors.append(motor) # Component 6 the Payload payload = SUAVE.Components.Energy.Peripherals.Payload() @@ -263,15 +274,14 @@ def vehicle_setup(): # Component 8 the Battery bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion() bat.mass_properties.mass = 90.0 * Units.kg - bat.specific_energy = 700. * Units.Wh/Units.kg - bat.resistance = 0.05 - bat.max_voltage = 45.0 - initialize_from_mass(bat,bat.mass_properties.mass) + bat.specific_energy = 600. * Units.Wh/Units.kg + bat.max_voltage = 130.0 + initialize_from_mass(bat) net.battery = bat #Component 9 the system logic controller and MPPT logic = SUAVE.Components.Energy.Distributors.Solar_Logic() - logic.system_voltage = 40.0 + logic.system_voltage = 120.0 logic.MPPT_efficiency = 0.95 net.solar_logic = logic @@ -354,7 +364,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Energy energy = SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors #what is called throughout the mission (at every time step)) + energy.network = vehicle.networks #what is called throughout the mission (at every time step)) analyses.append(energy) # ------------------------------------------------------------------ @@ -392,12 +402,7 @@ def mission_setup(analyses,vehicle): # base segment base_segment = Segments.Segment() - ones_row = base_segment.state.ones_row - base_segment.process.iterate.unknowns.network = vehicle.propulsors.solar.unpack_unknowns - base_segment.process.iterate.residuals.network = vehicle.propulsors.solar.residuals base_segment.process.iterate.initials.initialize_battery = SUAVE.Methods.Missions.Segments.Common.Energy.initialize_battery - base_segment.state.unknowns.propeller_power_coefficient = vehicle.propulsors.solar.propeller.design_power_coefficient * ones_row(1)/15. - base_segment.state.residuals.network = 0. * ones_row(1) # ------------------------------------------------------------------ # Cruise Segment: constant speed, constant altitude @@ -411,14 +416,16 @@ def mission_setup(analyses,vehicle): # segment attributes segment.state.numerics.number_control_points = 64 - segment.start_time = time.strptime("Tue, Jun 21 11:30:00 2020", "%a, %b %d %H:%M:%S %Y",) + segment.start_time = time.strptime("Tue, Jun 21 11:30:00 2022", "%a, %b %d %H:%M:%S %Y",) segment.altitude = 15.0 * Units.km segment.mach = 0.12 segment.distance = 3050.0 * Units.km - segment.battery_energy = vehicle.propulsors.solar.battery.max_energy*0.2 #Charge the battery to start + segment.battery_energy = vehicle.networks.solar.battery.max_energy*0.3 #Charge the battery to start segment.latitude = 37.4300 # this defaults to degrees (do not use Units.degrees) segment.longitude = -122.1700 # this defaults to degrees + segment = vehicle.networks.solar.add_unknowns_and_residuals_to_segment(segment,initial_power_coefficient = 0.05) + mission.append_segment(segment) # ------------------------------------------------------------------ @@ -454,12 +461,15 @@ def plot_mission(results): # Plot Aerodynamic Coefficients plot_aerodynamic_coefficients(results) + + # Drag Components + plot_drag_components(results) # Plot Aircraft Flight Speed plot_aircraft_velocities(results) # Plot Aircraft Electronics - plot_electronic_conditions(results) + plot_battery_pack_conditions(results) # Plot Propeller Conditions plot_propeller_conditions(results)