示例#1
0
def simple_sizing(nexus):

    # Pull out the vehicle
    vec = nexus.vehicle_configurations.base

    # Change the dynamic pressure based on the, add a factor of safety
    vec.envelope.maximum_dynamic_pressure = nexus.missions.mission.segments.cruise.dynamic_pressure * 1.2

    # Scale the horizontal and vertical tails based on the main wing area
    vec.wings.horizontal_stabilizer.areas.reference = 0.15 * vec.reference_area
    vec.wings.vertical_stabilizer.areas.reference = 0.08 * vec.reference_area

    # wing spans,areas, and chords
    for wing in vec.wings:

        # Unpack
        AR = wing.aspect_ratio
        S = wing.areas.reference

        # Set the spans
        wing.spans.projected = np.sqrt(AR * S)

        # Set all of the areas for the surfaces
        wing.areas.wetted = 2.0 * S
        wing.areas.exposed = 1.0 * wing.areas.wetted
        wing.areas.affected = 1.0 * wing.areas.wetted

        # Set all of the chord lengths
        chord = wing.areas.reference / wing.spans.projected
        wing.chords.mean_aerodynamic = chord
        wing.chords.mean_geometric = chord
        wing.chords.root = chord
        wing.chords.tip = chord

    # Size solar panel area
    wing_area = vec.reference_area
    spanel = vec.propulsors.network.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.network.motor
    kv = motor.speed_constant
    motor = size_from_kv(motor, kv)

    # diff the new data
    vec.store_diff()

    return nexus
示例#2
0
def simple_sizing(nexus):
    
    # Pull out the vehicle
    vec = nexus.vehicle_configurations.base
    
    # Change the dynamic pressure based on the, add a factor of safety   
    vec.envelope.maximum_dynamic_pressure = nexus.missions.mission.segments.cruise.dynamic_pressure*1.2
    
    # Scale the horizontal and vertical tails based on the main wing area
    vec.wings.horizontal_stabilizer.areas.reference = 0.15 * vec.reference_area
    vec.wings.vertical_stabilizer.areas.reference   = 0.08 * vec.reference_area

    # wing spans,areas, and chords
    for wing in vec.wings:
        
        # Unpack
        AR = wing.aspect_ratio
        S  = wing.areas.reference
        
        # Set the spans
        wing.spans.projected = np.sqrt(AR*S)
        
        # Set all of the areas for the surfaces
        wing.areas.wetted   = 2.0 * S
        wing.areas.exposed  = 1.0 * wing.areas.wetted
        wing.areas.affected = 1.0 * wing.areas.wetted   
        
        # Set all of the chord lengths
        chord = wing.areas.reference/wing.spans.projected
        wing.chords.mean_aerodynamic = chord
        wing.chords.mean_geometric   = chord
        wing.chords.root             = chord
        wing.chords.tip              = chord

    # Size solar panel area
    wing_area                   = vec.reference_area
    spanel                      = vec.propulsors.network.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.network.motor
    kv    = motor.speed_constant
    motor = size_from_kv(motor, kv)    
    
    # diff the new data
    vec.store_diff()

    return nexus
示例#3
0
def vehicle_setup():

    # ------------------------------------------------------------------
    #   Initialize the Vehicle
    # ------------------------------------------------------------------

    vehicle = SUAVE.Vehicle()
    vehicle.tag = 'Tecnam_P2006TElectric'

    # ------------------------------------------------------------------
    #   Vehicle-level Properties
    # ------------------------------------------------------------------

    # mass properties
    vehicle.mass_properties.max_takeoff = 1400 * Units.kilogram
    vehicle.mass_properties.takeoff = 1400 * Units.kilogram
    vehicle.mass_properties.operating_empty = 1000 * Units.kilogram
    vehicle.mass_properties.max_zero_fuel = 1400 * Units.kilogram
    vehicle.mass_properties.cargo = 80 * Units.kilogram

    # envelope properties
    vehicle.envelope.ultimate_load = 5.7
    vehicle.envelope.limit_load = 3.8

    # basic parameters
    vehicle.reference_area = 64.4 * Units['meters**2']
    vehicle.passengers = 4
    vehicle.systems.control = "fully powered"
    vehicle.systems.accessories = "medium range"

    # ------------------------------------------------------------------
    #  Landing Gear
    # ------------------------------------------------------------------
    # used for noise calculations
    #landing_gear = SUAVE.Components.Landing_Gear.Landing_Gear()
    #landing_gear.tag = "main_landing_gear"

    #landing_gear.main_tire_diameter = 0.423 * Units.m
    #landing_gear.nose_tire_diameter = 0.3625 * Units.m
    #landing_gear.main_strut_length  = 0.4833 * Units.m
    #landing_gear.nose_strut_length  = 0.3625 * Units.m
    #landing_gear.main_units  = 2    #number of main landing gear units
    #landing_gear.nose_units  = 1    #number of nose landing gear
    #landing_gear.main_wheels = 1    #number of wheels on the main landing gear
    #landing_gear.nose_wheels = 1    #number of wheels on the nose landing gear
    #vehicle.landing_gear = landing_gear

    # ------------------------------------------------------------------
    #  Fuselage
    # ------------------------------------------------------------------

    fuselage = SUAVE.Components.Fuselages.Fuselage()
    fuselage.tag = 'fuselage'
    aux = time.time()
    fuselage.time = aux

    fuselage.number_coach_seats = vehicle.passengers
    fuselage.seats_abreast = 2
    fuselage.seat_pitch = 0.995 * Units.meter
    fuselage.fineness.nose = 1.27
    fuselage.fineness.tail = 1  #3.31
    fuselage.lengths.nose = 1.16 * Units.meter
    fuselage.lengths.tail = 4.637 * Units.meter
    fuselage.lengths.cabin = 2.653 * Units.meter
    fuselage.lengths.total = 8.45 * Units.meter
    fuselage.lengths.fore_space = 0.0 * Units.meter
    fuselage.lengths.aft_space = 0.0 * Units.meter
    fuselage.width = 1.1 * Units.meter  #1.22
    fuselage.heights.maximum = 1.41 * Units.meter
    fuselage.effective_diameter = 2 * Units.meter
    fuselage.areas.side_projected = 7.46 * Units['meters**2']
    fuselage.areas.wetted = 25.0 * Units['meters**2']
    fuselage.areas.front_projected = 1.54 * Units['meters**2']
    fuselage.differential_pressure = 10**5 * Units.pascal  # Maximum differential pressure

    fuselage.heights.at_quarter_length = 1.077 * Units.meter
    fuselage.heights.at_three_quarters_length = 0.5 * Units.meter  #0.621 * Units.meter
    fuselage.heights.at_wing_root_quarter_chord = 1.41 * Units.meter

    ## OpenVSP Design

    fuselage.OpenVSP_values = Data()  # VSP uses degrees directly

    #MidFuselage1 Section

    fuselage.OpenVSP_values.midfus1 = Data()
    fuselage.OpenVSP_values.midfus1.z_pos = 0.03

    #MidFuselage2 Section

    fuselage.OpenVSP_values.midfus2 = Data()
    fuselage.OpenVSP_values.midfus2.z_pos = 0.06

    #MidFuselage3 Section

    fuselage.OpenVSP_values.midfus3 = Data()
    fuselage.OpenVSP_values.midfus3.z_pos = 0.04

    #Tail Section

    fuselage.OpenVSP_values.tail = Data()
    fuselage.OpenVSP_values.tail.bottom = Data()
    fuselage.OpenVSP_values.tail.z_pos = 0.039
    fuselage.OpenVSP_values.tail.bottom.angle = -20.0
    fuselage.OpenVSP_values.tail.bottom.strength = 1

    # add to vehicle
    vehicle.append_component(fuselage)

    # ------------------------------------------------------------------
    #   Main Wing
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Main_Wing()
    wing.tag = 'main_wing'

    wing.thickness_to_chord = 0.15249979370200092
    wing.taper = 0.9014171440917205
    wing.spans.projected = 9.342124951930751 * Units.meter
    wing.chords.root = 2.0273876759854024 * Units.meter
    wing.chords.tip = wing.chords.root * wing.taper
    wing.chords.mean_aerodynamic = (wing.chords.root * (2.0 / 3.0) *
                                    ((1.0 + wing.taper + wing.taper**2.0) /
                                     (1.0 + wing.taper)))
    wing.areas.reference = (wing.chords.root +
                            wing.chords.tip) * wing.spans.projected / 2
    print wing.areas.reference
    basearea = wing.areas.reference
    wing.areas.wetted = 2.0 * wing.areas.reference
    wing.areas.exposed = wing.areas.wetted
    wing.areas.affected = wing.areas.wetted
    wing.twists.root = 0. * Units.degrees
    wing.twists.tip = 0. * Units.degrees
    wing.dihedral = 1. * Units.degrees
    wing.origin = [2.986, 0, 1.077]  # meters
    wing.sweeps.leading_edge = 1.9 * Units.deg
    wing.aspect_ratio = (wing.spans.projected *
                         wing.spans.projected) / wing.areas.reference
    wing.span_efficiency = 0.95
    wing.vertical = False
    wing.symmetric = True
    wing.high_lift = True
    wing.dynamic_pressure_ratio = 1.0

    ## Wing Segments

    # Root Segment

    #segment = SUAVE.Components.Wings.Segment()

    #segment.tag                   = 'root'
    #segment.percent_span_location = 0.0
    #segment.twist                 = 0. * Units.deg
    #segment.root_chord_percent    = 1.
    #segment.dihedral_outboard     = 1. * Units.degrees
    #segment.sweeps.quarter_chord  = 0. * Units.degrees
    #segment.thickness_to_chord    = 0.15

    #airfoil = SUAVE.Components.Wings.Airfoils.Airfoil()
    #airfoil.coordinate_file       = '/Users/Bruno/Documents/Delft/Courses/2016-2017/Thesis/Code/Airfoils/naca642415.dat'

    #segment.append_airfoil(airfoil)
    #wing.Segments.append(segment)

    # Tip Segment

    #segment = SUAVE.Components.Wings.Segment()

    #segment.tag                   = 'tip'
    #segment.percent_span_location = 1.0
    #segment.twist                 = 0. * Units.deg
    #segment.root_chord_percent    = 1.
    #segment.dihedral_outboard     = 1. * Units.degrees
    #segment.sweeps.quarter_chord  = 0. * Units.degrees
    #segment.thickness_to_chord    = 0.15

    #airfoil = SUAVE.Components.Wings.Airfoils.Airfoil()
    #airfoil.coordinate_file       = '/Users/Bruno/Documents/Delft/Courses/2016-2017/Thesis/Code/Airfoils/naca642415.dat'

    #segment.append_airfoil(airfoil)
    #wing.Segments.append(segment)

    # ------------------------------------------------------------------
    #   Flaps
    # ------------------------------------------------------------------

    wing.flaps.chord = wing.chords.root * 0.15
    wing.flaps.span_start = 0.3 * wing.spans.projected
    wing.flaps.span_end = 0.8 * wing.spans.projected
    wing.flaps.area = wing.flaps.chord * (wing.flaps.span_end -
                                          wing.flaps.span_start)
    wing.flaps.type = 'single_slotted'

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------
    #  Horizontal Stabilizer
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'horizontal_stabilizer'

    wing.aspect_ratio = 4.193
    wing.areas.reference = 0.145 * basearea
    wing.sweeps.quarter_chord = 0.0 * Units.deg
    wing.thickness_to_chord = 0.12
    wing.taper = 1.0
    wing.span_efficiency = 0.97
    wing.spans.projected = np.sqrt(wing.aspect_ratio * wing.areas.reference)
    wing.chords.root = wing.areas.reference / wing.spans.projected
    wing.chords.tip = wing.chords.root
    wing.chords.mean_aerodynamic = (wing.chords.root * (2.0 / 3.0) *
                                    ((1.0 + wing.taper + wing.taper**2.0) /
                                     (1.0 + wing.taper)))
    wing.areas.wetted = 2.0 * wing.areas.reference
    wing.areas.exposed = wing.areas.wetted
    wing.areas.affected = wing.areas.wetted
    wing.twists.root = 0.0 * Units.degrees
    wing.twists.tip = 0.0 * Units.degrees
    wing.origin = [7.789, 0.0, 0.3314]  # meters
    wing.vertical = False
    wing.symmetric = True
    wing.dynamic_pressure_ratio = 0.9

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------
    #   Vertical Stabilizer
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'vertical_stabilizer'

    wing.areas.reference = 0.099 * basearea
    wing.areas.wetted = 2.0 * wing.areas.reference
    wing.areas.exposed = wing.areas.wetted
    wing.areas.affected = wing.areas.wetted
    wing.aspect_ratio = 1.407
    wing.sweeps.quarter_chord = 38.75 * Units.deg
    wing.thickness_to_chord = 0.12
    wing.taper = 0.4142
    wing.span_efficiency = 0.97
    wing.spans.projected = np.sqrt(wing.aspect_ratio * wing.areas.reference)
    wing.chords.root = (2.0 * wing.areas.reference) / (wing.spans.projected *
                                                       (1 + wing.taper))
    wing.chords.tip = wing.chords.root * wing.taper
    wing.chords.mean_aerodynamic = (wing.chords.root * (2.0 / 3.0) *
                                    ((1.0 + wing.taper + wing.taper**2.0) /
                                     (1.0 + wing.taper)))
    wing.twists.root = 0.0 * Units.degrees
    wing.twists.tip = 0.0 * Units.degrees
    wing.origin = [7.25, 0, 0.497]  # meters
    wing.vertical = True
    wing.symmetric = False
    wing.t_tail = False
    wing.dynamic_pressure_ratio = 1.0

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------
    #  Propellers Powered By Batteries
    # ------------------------------------------------------------------

    # build network
    net = SUAVE.Components.Energy.Networks.Lift_Forward_Propulsor()

    net.nacelle_diameter_lift = 0.08 * Units.meters
    net.nacelle_diameter_forward = 0.1732 * Units.meters
    net.engine_length_lift = 0.47244 * Units.meters
    net.engine_length_forward = 1.2 * Units.meters
    net.number_of_engines_lift = 10
    print 'Prop Optimization'
    print 'Engines Lift Number'
    print net.number_of_engines_lift
    net.number_of_engines_forward = 2
    net.thrust_angle_lift = 0.0 * Units.degrees
    net.thrust_angle_forward = 0.0 * Units.degrees
    net.voltage = 461. * Units['volt']  #461.
    net.areas_forward = Data()
    net.areas_forward.wetted = 1.1 * np.pi * net.nacelle_diameter_forward * net.engine_length_forward
    net.areas_lift = Data()
    net.areas_lift.wetted = 1.1 * np.pi * net.nacelle_diameter_forward * net.engine_length_lift
    net.number_of_engines = 1
    net.nacelle_diameter = net.nacelle_diameter_forward
    net.areas = Data()
    net.areas.wetted = net.areas_lift.wetted
    net.engine_length = 1.

    # Component 1 - Tip ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95  # Gundlach for brushless motors
    net.esc_forward = esc

    # Component 1 - High Lift ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95  # Gundlach for brushless motors
    net.esc_lift = esc

    # Component 2 - Tip Propeller

    # Design the Propeller
    #prop_attributes = Data()

    #prop_attributes                     = propeller_design(prop_attributes)

    prop_forward = SUAVE.Components.Energy.Converters.Propeller()
    prop_forward.number_blades = 3.0
    prop_forward.propulsive_efficiency = 0.85
    prop_forward.freestream_velocity = 50.0 * Units['m/s']  # freestream m/s
    prop_forward.angular_velocity = 27500. * Units['rpm']  # For 20x10 prop
    prop_forward.tip_radius = 0.5 * Units.meter
    prop_forward.hub_radius = 0.085 * Units.meter
    prop_forward.design_Cl = 0.8
    prop_forward.design_altitude = 14.0 * Units.km
    prop_forward.design_thrust = 0.0 * Units.newton
    prop_forward.design_power = 60000. * Units.watts

    prop_forward = propeller_design(prop_forward)
    net.propeller_forward = prop_forward

    # Component 2 - High Lift Propeller

    # Design the Propeller
    #prop_attributes = Data()

    prop_lift = SUAVE.Components.Energy.Converters.Propeller()
    prop_lift.number_blades = 5.0
    prop_lift.propulsive_efficiency = 0.85
    prop_lift.freestream_velocity = 1. * Units['m/s']  # freestream m/s
    prop_lift.angular_velocity = 2750 * Units['rpm']  # For 20x10 prop
    prop_lift.tip_radius = 0.26 * Units.meter  #0.2880360
    prop_lift.hub_radius = 0.07772400 * Units.meter
    prop_lift.design_Cl = 0.8
    prop_lift.design_altitude = 0.0 * Units.meter
    prop_lift.design_thrust = 0.0 * Units.newton
    prop_lift.design_power = 10500. * Units.watts
    prop_lift = propeller_design(prop_lift)

    net.propeller_lift = prop_lift

    # Component 3 - Tip Motor

    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    #motor.resistance           = 1.
    #motor.no_load_current      = 7.  * Units.ampere
    #motor.speed_constant       = 11.9999 * Units['rpm/volt'] # RPM/volt converted to (rad/s)/volt
    #motor.propeller_radius     = prop_forward.tip_radius
    #motor.propeller_Cp         = prop_forward.Cp[0]
    #motor.gear_ratio           = 12. # Gear ratio
    #motor.gearbox_efficiency   = .98 # Gear box efficiency
    #motor.expected_current     = 160. # Expected current
    #motor.mass_properties.mass = 9.0  * Units.kg
    #net.motor_forward          = motor

    motor.speed_constant = 180. * Units['rpm/volt']  # RPM/volt is standard
    motor = size_from_kv(motor, motor.speed_constant)
    motor.gear_ratio = 1.  # Gear ratio, no gearbox
    motor.gearbox_efficiency = .98  # Gear box efficiency, no gearbox
    motor.motor_efficiency = 0.825
    net.motor_forward = motor

    # Component 3 - High Lift Motor

    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    #motor.resistance           = 0.008
    #motor.no_load_current      = 4.5  * Units.ampere
    #motor.speed_constant       = 5800. * Units['rpm/volt'] # RPM/volt converted to (rad/s)/volt
    #motor.propeller_radius     = prop_lift.tip_radius
    #motor.propeller_Cp         = prop_lift.Cp[0]
    #motor.gear_ratio           = 12. # Gear ratio
    #motor.gearbox_efficiency   = .98 # Gear box efficiency
    #motor.expected_current     = 25. # Expected current
    #motor.mass_properties.mass = 6.0  * Units.kg
    #net.motor_lift             = motor

    motor.speed_constant = 90. * Units['rpm/volt']  # RPM/volt is standard
    motor = size_from_kv(motor, motor.speed_constant)
    motor.gear_ratio = 1.  # Gear ratio, no gearbox
    motor.gearbox_efficiency = .98  # Gear box efficiency, no gearbox
    motor.motor_efficiency = 0.825
    net.motor_lift = motor

    # Component 4 - the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw = 50. * Units.watts
    payload.mass_properties.mass = 5.0 * Units.kg
    net.payload = payload

    # Component 5 - the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 50. * Units.watts
    net.avionics = avionics

    # Component 6 - the Battery
    bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion(
    )
    bat.mass_properties.mass = 386.0 * Units.kg
    bat.specific_energy = 121.8 * Units.Wh / Units.kg  #192.84
    bat.specific_power = 0.312 * Units.kW / Units.kg  #0.837
    bat.resistance = 0.32
    bat.max_voltage = 538. * Units['volt']  #10000.
    initialize_from_mass(bat, bat.mass_properties.mass)
    print bat.max_energy
    net.battery = bat

    # ------------------------------------------------------------------
    #   Vehicle Definition Complete
    # ------------------------------------------------------------------

    # add the energy network to the vehicle
    vehicle.append_component(net)

    #now add weights objects
    vehicle.landing_gear = SUAVE.Components.Landing_Gear.Landing_Gear()
    vehicle.control_systems = SUAVE.Components.Physical_Component()
    vehicle.electrical_systems = SUAVE.Components.Physical_Component()
    vehicle.avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    vehicle.passenger_weights = SUAVE.Components.Physical_Component()
    #vehicle.furnishings        = SUAVE.Components.Physical_Component()
    #vehicle.apu                = SUAVE.Components.Physical_Component()
    #vehicle.hydraulics         = SUAVE.Components.Physical_Component()
    vehicle.optionals = SUAVE.Components.Physical_Component()

    vehicle.wings[
        'vertical_stabilizer'].rudder = SUAVE.Components.Physical_Component()

    #print vehicle

    return vehicle
示例#4
0
def simple_sizing(nexus):
    configs = nexus.vehicle_configurations
    base = configs.base

    #find conditions
    air_speed = nexus.missions.mission.segments['cruise'].air_speed
    altitude = nexus.missions.mission.segments['climb_2'].altitude_end
    atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()

    freestream = atmosphere.compute_values(altitude)
    freestream0 = atmosphere.compute_values(6000. * Units.ft)  #cabin altitude

    diff_pressure = np.max(freestream0.pressure - freestream.pressure, 0)
    fuselage = base.fuselages['fuselage']
    fuselage.differential_pressure = diff_pressure

    #now size engine
    mach_number = air_speed / freestream.speed_of_sound

    #now add to freestream data object
    freestream.velocity = air_speed
    freestream.mach_number = mach_number
    freestream.gravity = 9.81

    conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics(
    )  #assign conditions in form for propulsor sizing
    conditions.freestream = freestream

    for config in configs:

        # fuselage
        fuselage = config.fuselages['fuselage']
        fuselage.differential_pressure = diff_pressure

        # Main Wing

        main_wing_span = config.wings.main_wing.spans.projected
        main_wing_root_chord = config.wings.main_wing.chords.root
        config.wings.main_wing.chords.tip = config.wings.main_wing.chords.root * config.wings.main_wing.taper
        config.wings.main_wing.chords.mean_aerodynamic = (
            main_wing_root_chord * (2.0 / 3.0) *
            ((1.0 + config.wings.main_wing.taper +
              config.wings.main_wing.taper**2.0) /
             (1.0 + config.wings.main_wing.taper)))
        config.wings.main_wing.areas.reference = (
            main_wing_root_chord +
            config.wings.main_wing.chords.tip) * main_wing_span / 2.0
        config.wings.main_wing.areas.wetted = 2.0 * config.wings.main_wing.areas.reference
        config.wings.main_wing.areas.exposed = config.wings.main_wing.areas.wetted
        config.wings.main_wing.areas.affected = config.wings.main_wing.areas.wetted
        config.wings.main_wing.aspect_ratio = (
            main_wing_span *
            main_wing_span) / config.wings.main_wing.areas.reference

        config.wings.main_wing.flaps.chord = main_wing_root_chord * 0.15
        config.wings.main_wing.flaps.span_start = 0.3 * main_wing_span
        config.wings.main_wing.flaps.span_end = 0.8 * main_wing_span
        config.wings.main_wing.flaps.area = config.wings.main_wing.flaps.chord * (
            config.wings.main_wing.flaps.span_end -
            config.wings.main_wing.flaps.span_start)

        # Horizontal Stabilizer

        config.wings.horizontal_stabilizer.areas.reference = 0.145 * config.wings.main_wing.areas.reference
        config.wings.horizontal_stabilizer.spans.projected = np.sqrt(
            config.wings.horizontal_stabilizer.aspect_ratio *
            config.wings.horizontal_stabilizer.areas.reference)
        config.wings.horizontal_stabilizer.chords.root = config.wings.horizontal_stabilizer.areas.reference / config.wings.horizontal_stabilizer.spans.projected
        config.wings.horizontal_stabilizer.chords.tip = config.wings.horizontal_stabilizer.chords.root
        config.wings.horizontal_stabilizer.chords.mean_aerodynamic = (
            config.wings.horizontal_stabilizer.chords.root * (2.0 / 3.0) *
            ((1.0 + config.wings.horizontal_stabilizer.taper +
              config.wings.horizontal_stabilizer.taper**2.0) /
             (1.0 + config.wings.horizontal_stabilizer.taper)))
        config.wings.horizontal_stabilizer.areas.wetted = 2.0 * config.wings.horizontal_stabilizer.areas.reference
        config.wings.horizontal_stabilizer.areas.exposed = config.wings.horizontal_stabilizer.areas.wetted
        config.wings.horizontal_stabilizer.areas.affected = config.wings.horizontal_stabilizer.areas.wetted

        # Vertical Stabilizer

        config.wings.vertical_stabilizer.areas.reference = 0.099 * config.wings.main_wing.areas.reference
        config.wings.vertical_stabilizer.areas.wetted = 2.0 * config.wings.vertical_stabilizer.areas.reference
        config.wings.vertical_stabilizer.areas.exposed = config.wings.vertical_stabilizer.areas.wetted
        config.wings.vertical_stabilizer.areas.affected = config.wings.vertical_stabilizer.areas.wetted

        config.wings.vertical_stabilizer.spans.projected = np.sqrt(
            config.wings.vertical_stabilizer.aspect_ratio *
            config.wings.vertical_stabilizer.areas.reference)
        config.wings.vertical_stabilizer.chords.root = (
            2.0 * config.wings.vertical_stabilizer.areas.reference) / (
                config.wings.vertical_stabilizer.spans.projected *
                (1 + config.wings.vertical_stabilizer.taper))
        config.wings.vertical_stabilizer.chords.tip = config.wings.vertical_stabilizer.chords.root * config.wings.vertical_stabilizer.taper
        config.wings.vertical_stabilizer.chords.mean_aerodynamic = (
            config.wings.vertical_stabilizer.chords.root * (2.0 / 3.0) *
            ((1.0 + config.wings.vertical_stabilizer.taper +
              config.wings.vertical_stabilizer.taper**2.0) /
             (1.0 + config.wings.vertical_stabilizer.taper)))

        # Resize the motor
        kv = config.propulsors.propulsor.motor_forward.speed_constant
        config.propulsors.propulsor.motor_forward = size_from_kv(
            config.propulsors.propulsor.motor_forward, kv)

        kv = config.propulsors.propulsor.motor_lift.speed_constant
        config.propulsors.propulsor.motor_lift = size_from_kv(
            config.propulsors.propulsor.motor_lift, kv)

        # diff the new data
        config.store_diff()

        #turbofan_sizing(config.propulsors['turbofan'], mach_number = mach_number, altitude = altitude)
        #compute_turbofan_geometry(config.propulsors['turbofan'], conditions)

    # ------------------------------------------------------------------
    #   Landing Configuration
    # ------------------------------------------------------------------
    landing = nexus.vehicle_configurations.landing
    landing_conditions = Data()
    landing_conditions.freestream = Data()

    # landing weight
    landing.mass_properties.landing = 1.0 * config.mass_properties.takeoff

    # Landing CL_max
    altitude = nexus.missions.mission.segments[-1].altitude_end
    atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
    freestream_landing = atmosphere.compute_values(0.)
    landing_conditions.freestream.velocity = nexus.missions.mission.segments[
        'descent_2'].air_speed
    landing_conditions.freestream.density = freestream_landing.density
    landing_conditions.freestream.dynamic_viscosity = freestream_landing.dynamic_viscosity
    CL_max_landing, CDi = compute_max_lift_coeff(landing, landing_conditions)
    landing.maximum_lift_coefficient = CL_max_landing

    #Takeoff CL_max
    takeoff = nexus.vehicle_configurations.takeoff
    takeoff_conditions = Data()
    takeoff_conditions.freestream = Data()
    altitude = nexus.missions.mission.airport.altitude
    freestream_takeoff = atmosphere.compute_values(altitude)

    takeoff_conditions.freestream.velocity = nexus.missions.mission.segments.climb_1.air_speed
    takeoff_conditions.freestream.density = freestream_takeoff.density
    takeoff_conditions.freestream.dynamic_viscosity = freestream_takeoff.dynamic_viscosity
    max_CL_takeoff, CDi = compute_max_lift_coeff(takeoff, takeoff_conditions)
    takeoff.maximum_lift_coefficient = max_CL_takeoff

    #Base config CL_max
    base = nexus.vehicle_configurations.base
    base_conditions = Data()
    base_conditions.freestream = takeoff_conditions.freestream
    max_CL_base, CDi = compute_max_lift_coeff(base, base_conditions)
    base.maximum_lift_coefficient = max_CL_base

    return nexus
示例#5
0
def main():

    #------------------------------------------------------------------
    # Network
    #------------------------------------------------------------------

    # 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()
    net.solar_flux = sun

    # Component 2 the solar panels
    panel = SUAVE.Components.Energy.Converters.Solar_Panel()
    panel.ratio = 0.9
    panel.area = 1.0 * panel.ratio
    panel.efficiency = 0.25
    panel.mass_properties.mass = panel.area * (0.60 * Units.kg)
    net.solar_panel = panel

    # Component 3 the ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95  # Gundlach for brushless motors
    net.esc = esc

    # Component 5 the Propeller
    prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
    prop.propulsive_efficiency = 0.825
    net.propeller = prop

    # Component 4 the Motor
    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    motor.speed_constant = 800. * Units['rpm/volt']  # RPM/volt is standard
    motor = size_from_kv(motor)
    motor.gear_ratio = 1.  # Gear ratio, no gearbox
    motor.gearbox_efficiency = 1.  # Gear box efficiency, no gearbox
    motor.motor_efficiency = 0.825
    net.motor = motor

    # Component 6 the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw = 0.  #Watts
    payload.mass_properties.mass = 0.0 * Units.kg
    net.payload = payload

    # Component 7 the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 10.  #Watts
    net.avionics = avionics

    # Component 8 the Battery
    bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion(
    )
    bat.mass_properties.mass = 5.0 * Units.kg
    bat.specific_energy = 250. * Units.Wh / Units.kg
    bat.resistance = 0.003
    bat.iters = 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 = 18.5
    logic.MPPT_efficiency = 0.95
    net.solar_logic = logic

    # Setup the conditions to run the network
    state = Data()
    state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics(
    )
    state.numerics = SUAVE.Analyses.Mission.Segments.Conditions.Numerics()

    conditions = state.conditions
    numerics = state.numerics

    # Calculate atmospheric properties
    atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
    atmosphere_conditions = atmosphere.compute_values(1000. * Units.ft)

    rho = atmosphere_conditions.density[0, :]
    a = atmosphere_conditions.speed_of_sound[0, :]
    mu = atmosphere_conditions.dynamic_viscosity[0, :]
    T = atmosphere_conditions.temperature[0, :]

    conditions.propulsion.throttle = np.array([[1.0], [1.0]])
    conditions.freestream.velocity = np.array([[1.0], [1.0]])
    conditions.freestream.density = np.array([rho, rho])
    conditions.freestream.dynamic_viscosity = np.array([mu, mu])
    conditions.freestream.speed_of_sound = np.array([a, a])
    conditions.freestream.altitude = np.array([[1000.0], [1000.0]])
    conditions.propulsion.battery_energy = bat.max_energy * np.ones_like(
        conditions.freestream.altitude)
    conditions.frames.body.inertial_rotations = np.zeros([2, 3])
    conditions.frames.inertial.time = np.array([[0.0], [1.0]])
    numerics.time.integrate = np.array([[0, 0], [0, 1]])
    numerics.time.differentiate = np.array([[0, 0], [0, 1]])
    numerics.time.control_points = np.array([[0, 0], [0, 1]])
    conditions.frames.planet.start_time = time.strptime(
        "Sat, Jun 21 06:00:00  2014",
        "%a, %b %d %H:%M:%S %Y",
    )
    conditions.frames.planet.latitude = np.array([[0.0], [0.0]])
    conditions.frames.planet.longitude = np.array([[0.0], [0.0]])
    conditions.freestream.temperature = np.array([T, T])
    conditions.frames.body.transform_to_inertial = np.array([[[1., 0., 0.],
                                                              [0., 1., 0.],
                                                              [0., 0., 1.]],
                                                             [[1., 0., 0.],
                                                              [0., 1., 0.],
                                                              [0., 0., 1.]]])
    # Run the network and print the results
    results = net(state)
    F = results.thrust_force_vector

    # Truth results
    truth_F = [[68.78277813], [68.78277813]]
    truth_i = [[5.75011436], [5.75011436]]
    truth_rpm = [[14390.30435183], [14390.30435183]]
    truth_bat = [[3169014.08450704], [3168897.35916947]]

    error = Data()
    error.Thrust = np.max(np.abs(F[:, 0] - truth_F))
    error.RPM = np.max(np.abs(conditions.propulsion.propeller_rpm - truth_rpm))
    error.Current = np.max(
        np.abs(conditions.propulsion.battery_current - truth_i))
    error.Battery = np.max(np.abs(bat.current_energy - truth_bat))

    print(error)

    for k, v in list(error.items()):
        assert (np.abs(v) < 1e-6)

    return
def base_setup(nexus):

    aerofoil = nexus.surrogate_data.vec.aerofoil
    results = generate_vehicle(nexus)

    s, rootChord, rcp, psl, sqc, do, tw, ttc, aero_geom, A_ref, span_vals, totmass = results
    c_bar, ca, cg = aero_geom
    A_ref_wet, A_ref_pln = A_ref
    wing_taper, wing_sweep = span_vals

    #    print '===== RESULTS'
    #    print results
    # ------------------------------------------------------------------
    #   Initialize the Vehicle
    # ------------------------------------------------------------------

    vehicle = SUAVE.Vehicle()
    vehicle.tag = 'ModBWB'

    # ------------------------------------------------------------------
    #   Vehicle-level Properties
    # ------------------------------------------------------------------
    # mass properties
    vehicle.mass_properties.takeoff = totmass * Units.kg
    #    vehicle.mass_properties.operating_empty = totmass * Units.kg
    #    vehicle.mass_properties.max_takeoff     = totmass * Units.kg

    # basic parameters
    vehicle.reference_area = A_ref_pln * Units.m**2
    vehicle.envelope.ultimate_load = 2.0
    vehicle.envelope.limit_load = 1.5
    vehicle.envelope.maximum_dynamic_pressure = 0.5 * 1.225 * (40.**2.)  #Max q

    # ------------------------------------------------------------------
    #   Main Wing
    # ------------------------------------------------------------------

    for i in range(0, len(psl) + 1):
        airfoil = SUAVE.Components.Wings.Airfoils.Airfoil()
        airfoil.coordinate_file = './marske1.dat'
        if i == 0:
            wing = SUAVE.Components.Wings.Wing()
            wing.tag = 'main_wing'

            wing.aspect_ratio = s**2 / vehicle.reference_area
            wing.thickness_to_chord = ttc[0]
            wing.taper = wing_taper
            wing.span_efficiency = 0.95

            wing.spans.projected = s * Units.m

            #            print 'ROOT CHORD : ' + str(rootChord)
            wing.chords.root = rootChord * Units.m
            wing.chords.tip = wing.taper * wing.chords.root
            wing.chords.mean_aerodynamic = c_bar * Units.m

            wing.areas.reference = A_ref_pln * Units.m**2
            wing.areas.wetted = A_ref_wet * Units.m**2
            wing.sweeps.quarter_chord = wing_sweep * Units.deg

            wing.twists.root = tw[0] * Units.deg
            wing.twists.tip = tw[-1] * Units.deg
            #            wing.dihedral                = do[0] * Units.deg

            wing.origin = [0., 0., 0]
            wing.aerodynamic_center = [ca, 0, 0]  #[ca,0,0]
            wing.center_of_gravity = [cg, 0., 0.]  #[cg,0.,0.]

            wing.vertical = False
            wing.symmetric = True
            wing.high_lift = True

            wing.dynamic_pressure_ratio = 1.0

            if len(psl) == 1:
                wing.dihedral = do[i] * Units.deg
                wing.sweeps.quarter_chord = sqc[i] * Units.deg

            # wing segments
        elif i > 0 and len(psl) > 1:
            segment = SUAVE.Components.Wings.Segment()
            segment.tag = 'section_' + str(i - 1)
            segment.percent_span_location = psl[i - 1]
            segment.root_chord_percent = rcp[i - 1]
            segment.dihedral_outboard = do[i - 1] * Units.deg
            segment.sweeps.quarter_chord = sqc[i - 1] * Units.deg
            segment.thickness_to_chord = ttc[i - 1]
            wing.Segments.append(segment)
            wing.Segments.append(segment)

    # add to vehicle
    vehicle.append_component(wing)

    #------------------------------------------------------------------
    # Propulsor
    #------------------------------------------------------------------

    # build network
    net = Solar_Low_Fidelity()
    net.number_of_engines = 0.  #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()
    net.solar_flux = sun

    # Component 2 the solar panels
    panel = SUAVE.Components.Energy.Converters.Solar_Panel()
    panel.ratio = 0.9
    panel.area = vehicle.reference_area * panel.ratio
    panel.efficiency = 0.25
    panel.mass_properties.mass = panel.area * (0.60 * Units.kg)
    net.solar_panel = panel

    # Component 3 the ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95  # Gundlach for brushless motors
    net.esc = esc

    # Component 5 the Propeller
    prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
    prop.propulsive_efficiency = 0.825
    net.propeller = prop

    # Component 4 the Motor
    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    kv = 800. * Units['rpm/volt']  # RPM/volt is standard
    motor = size_from_kv(motor, kv)
    motor.gear_ratio = 1.  # Gear ratio, no gearbox
    motor.gearbox_efficiency = 1.  # Gear box efficiency, no gearbox
    motor.motor_efficiency = 0.825
    net.motor = motor

    # Component 6 the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw = 0.  #Watts
    payload.mass_properties.mass = 0.0 * Units.kg
    net.payload = payload

    # Component 7 the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 10.  #Watts
    net.avionics = avionics

    # Component 8 the Battery
    bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion(
    )
    bat.mass_properties.mass = 5.0 * Units.kg
    bat.specific_energy = 250. * Units.Wh / Units.kg
    bat.resistance = 0.003
    bat.iters = 0
    initialize_from_mass(bat, bat.mass_properties.mass)
    net.battery = bat

    #Component 9 the system logic controller and MPPT
    logic = SUAVE.Components.Energy.Distributors.Solar_Logic()
    logic.system_voltage = 18.5
    logic.MPPT_efficiency = 0.95
    net.solar_logic = logic

    # add the solar network to the vehicle
    vehicle.append_component(net)

    return vehicle
示例#7
0
def base_setup():

    # ------------------------------------------------------------------
    #   Initialize the Vehicle
    # ------------------------------------------------------------------

    vehicle = SUAVE.Vehicle()
    vehicle.tag = 'Solar'

    # ------------------------------------------------------------------
    #   Vehicle-level Properties
    # ------------------------------------------------------------------
    # mass properties
    vehicle.mass_properties.takeoff = 4.00 * Units.kg
    vehicle.mass_properties.operating_empty = 4.00 * Units.kg
    vehicle.mass_properties.max_takeoff = 4.00 * Units.kg

    # basic parameters
    vehicle.reference_area = 1.0
    vehicle.envelope.ultimate_load = 2.0
    vehicle.envelope.limit_load = 1.5
    vehicle.envelope.maximum_dynamic_pressure = 115. * 1.25 * Units.pascals  #Max q

    # ------------------------------------------------------------------
    #   Main Wing
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Main_Wing()
    wing.tag = 'main_wing'

    wing.areas.reference = vehicle.reference_area
    wing.spans.projected = 40.0 * Units.meters
    wing.aspect_ratio = (wing.spans.projected**2) / wing.areas.reference
    wing.sweeps.quarter_chord = 0.0 * Units.deg
    wing.symmetric = True
    wing.thickness_to_chord = 0.12
    wing.taper = 1.0
    wing.vertical = False
    wing.high_lift = True
    wing.dynamic_pressure_ratio = 1.0
    wing.chords.mean_aerodynamic = wing.areas.reference / wing.spans.projected
    wing.twists.root = 0.0 * Units.degrees
    wing.twists.tip = 0.0 * Units.degrees
    wing.highlift = False
    wing.vertical = False
    wing.number_ribs = 26.
    wing.number_end_ribs = 2.
    wing.transition_x_upper = 0.6
    wing.transition_x_lower = 1.0
    wing.origin = [[3.0, 0.0, 0.0]]

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------
    #  Horizontal Stabilizer
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Horizontal_Tail()
    wing.tag = 'horizontal_stabilizer'

    wing.aspect_ratio = 10.
    wing.sweeps.quarter_chord = 0 * Units.deg
    wing.thickness_to_chord = 0.12
    wing.taper = 1.0
    wing.areas.reference = vehicle.reference_area * .15
    wing.areas.wetted = 2.0 * wing.areas.reference
    wing.areas.exposed = 0.8 * wing.areas.wetted
    wing.areas.affected = 0.6 * wing.areas.wetted
    wing.spans.projected = np.sqrt(wing.aspect_ratio * wing.areas.reference)
    wing.twists.root = 0.0 * Units.degrees
    wing.twists.tip = 0.0 * Units.degrees

    wing.vertical = False
    wing.symmetric = True
    wing.dynamic_pressure_ratio = 0.9
    wing.number_ribs = 5.0
    wing.chords.root = wing.areas.reference / wing.spans.projected
    wing.chords.tip = wing.areas.reference / wing.spans.projected
    wing.chords.mean_aerodynamic = wing.areas.reference / wing.spans.projected
    wing.origin = [[10., 0.0, 0.0]]

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------
    #   Vertical Stabilizer
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Vertical_Tail()
    wing.tag = 'vertical_stabilizer'

    wing.aspect_ratio = 10.
    wing.sweeps.quarter_chord = 0 * Units.deg
    wing.thickness_to_chord = 0.12
    wing.taper = 1.0
    wing.areas.reference = vehicle.reference_area * 0.1
    wing.spans.projected = np.sqrt(wing.aspect_ratio * wing.areas.reference)

    wing.chords.root = wing.areas.reference / wing.spans.projected
    wing.chords.tip = wing.areas.reference / wing.spans.projected
    wing.chords.mean_aerodynamic = wing.areas.reference / wing.spans.projected
    wing.areas.wetted = 2.0 * wing.areas.reference
    wing.areas.exposed = 0.8 * wing.areas.wetted
    wing.areas.affected = 0.6 * wing.areas.wetted
    wing.twists.root = 0.0 * Units.degrees
    wing.twists.tip = 0.0 * Units.degrees
    wing.origin = [[10., 0.0, 0.0]]
    wing.symmetric = True
    wing.vertical = True
    wing.t_tail = False
    wing.dynamic_pressure_ratio = 1.0
    wing.number_ribs = 5.

    # 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
    #------------------------------------------------------------------

    # build network
    net = Solar_Low_Fidelity()
    net.number_of_engines = 1.

    # Component 1 the Sun
    sun = SUAVE.Components.Energy.Processes.Solar_Radiation()
    net.solar_flux = sun

    # Component 2 the solar panels
    panel = SUAVE.Components.Energy.Converters.Solar_Panel()
    panel.ratio = 0.9
    panel.area = vehicle.reference_area * panel.ratio
    panel.efficiency = 0.25
    panel.mass_properties.mass = panel.area * (0.60 * Units.kg)
    net.solar_panel = panel

    # Component 3 the ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95  # Gundlach for brushless motors
    net.esc = esc

    # Component 4 the Propeller
    prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
    prop.propulsive_efficiency = 0.825
    net.propeller = prop

    # Component 5 the Motor
    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    motor.speed_constant = 900. * Units['rpm/volt']  # RPM/volt is standard
    motor = size_from_kv(motor)
    motor.gear_ratio = 1.  # Gear ratio, no gearbox
    motor.gearbox_efficiency = 1.  # Gear box efficiency, no gearbox
    motor.motor_efficiency = 0.8
    net.motor = motor

    # Component 6 the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw = 0.  #Watts
    payload.mass_properties.mass = 1.0 * Units.kg
    net.payload = payload

    # Component 7 the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 10.  #Watts
    net.avionics = avionics

    # Component 8 the Battery
    bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion(
    )
    bat.mass_properties.mass = 3.0 * Units.kg
    bat.specific_energy = 400. * Units.Wh / Units.kg
    bat.resistance = 0.003
    initialize_from_mass(bat, bat.mass_properties.mass)
    net.battery = bat

    #Component 9 the system logic controller and MPPT
    logic = SUAVE.Components.Energy.Distributors.Solar_Logic()
    logic.system_voltage = 18.5
    logic.MPPT_efficiency = 0.95
    net.solar_logic = logic

    # add the solar network to the vehicle
    vehicle.append_component(net)

    return vehicle
示例#8
0
def simple_sizing(nexus):

    # Pull out the vehicle
    vec = nexus.vehicle_configurations.base
    num_seg = nexus.surrogate_data.vec.init_vec.num_seg

    # Change the dynamic pressure based on the mission, add a factor of safety
    vec.envelope.maximum_dynamic_pressure = nexus.missions.mission.segments.cruise.dynamic_pressure * 1.2
    #    print vec.wings.main_wing
    # pull out variables that are being optimized
    new_vec = Data()
    new_vec.span = vec.wings.main_wing.spans.projected
    new_vec.root_chord = vec.wings.main_wing.chords.root
    new_vec.sqc = []
    new_vec.rcp = []
    new_vec.psl = []
    new_vec.do = []
    new_vec.tw = []
    new_vec.ttc = []

    print '================'
    in_segs = False
    for item in vec.wings.main_wing:
        if type(item) == type(
                vec.wings.main_wing.Segments):  # check if item is wing segment
            try:
                for i in range(0, num_seg):
                    key = 'section_' + str(i)
                    section = getattr(item, key)
                    #                print 'section_'+str(i) + '\n'+str(section)
                    new_vec.sqc.append(np.rad2deg(
                        section.sweeps.quarter_chord))
                    new_vec.rcp.append(section.root_chord_percent)
                    new_vec.psl.append(section.percent_span_location)
                    new_vec.do.append(np.rad2deg(section.dihedral_outboard))
                    new_vec.ttc.append(section.thickness_to_chord)
                    in_segs = True
            except Exception as err:
                print err
                print 'Not a wing segment, implied whole wing'
    if new_vec.psl == []:
        new_vec.sqc.append(np.rad2deg(
            vec.wings.main_wing.sweeps.quarter_chord))
        new_vec.rcp.append(1.)
        new_vec.rcp.append(vec.wings.main_wing.taper)
        new_vec.psl.append(0.)
        new_vec.do.append(np.rad2deg(vec.wings.main_wing.dihedral))
        new_vec.ttc.append(vec.wings.main_wing.thickness_to_chord)

    new_vec.tw.append(np.rad2deg(vec.wings.main_wing.twists.root))
    new_vec.tw.append(np.rad2deg(vec.wings.main_wing.twists.tip))

    if in_segs:
        new_vec.rcp.append(vec.wings.main_wing.taper)

    #       logic checks
    # span 2* chord at min
    if new_vec.span < 2 * new_vec.root_chord:
        new_vec.span = 2 * new_vec.root_chord
    # no inboard psl less than psl outboard
    if len(new_vec.psl) > 1:
        for i in range(1, len(new_vec.psl)):
            if new_vec.psl[i] < new_vec.psl[i - 1]:
                new_vec.psl[i] = new_vec.psl[i -
                                             1] + (1 - new_vec.psl[i - 1]) / 2
                # should find intermediate location
    # no outboard chord section larger than inboard (wing tear)
    for i in range(1, len(new_vec.rcp)):
        if new_vec.rcp[i] > new_vec.rcp[i - 1]:
            new_vec.rcp[i] = new_vec.rcp[i - 1]

    #   assign new iteration of vehicle to surrog data vehicle store
    nexus.surrogate_data.vec.make_vec = new_vec

    results = None

    results = generate_vehicle(nexus)

    s, rootChord, rcp, psl, sqc, do, tw, ttc, aero_geom, A_ref, span_vals, totmass = results
    c_bar, ca, cg = aero_geom
    A_ref_wet, A_ref_pln = A_ref
    wing_taper, wing_sweep = span_vals
    """
        UPDATE ALL NECESSARY THINGS (:

    """

    # update all wing structure values
    vec.mass_properties.takeoff = totmass * Units.kg
    #    vec.mass_properties.operating_empty = totmass * Units.kg
    #    vec.mass_properties.max_takeoff     = totmass * Units.kg

    vec.reference_area = A_ref_pln * Units.m**2

    vw = vec.wings.main_wing
    vw.spans.projected = s * Units.m

    vw.taper = wing_taper
    vw.chords.root = rootChord * Units.m
    vw.chords.tip = wing_taper * vw.chords.root
    vw.chords.mean_aerodynamic = c_bar * Units.m

    vw.areas.reference = A_ref_pln * Units.m**2
    vw.areas.wetted = A_ref_wet * Units.m**2
    vw.aspect_ratio = s**2 / (A_ref_pln)

    vw.sweeps.quarter_chord = wing_sweep * Units.deg

    vw.twists.root = new_vec.tw[0] * Units.deg
    vw.twists.tip = new_vec.tw[-1] * Units.deg

    if len(psl) == 1:
        vw.dihedral = do[0] * Units.deg
        vw.sweeps.quarter_chord = sqc[0] * Units.deg

    # update all segment values
    if len(psl) > 1:
        for item in vec.wings.main_wing:
            if type(item) == type(vec.wings.main_wing.Segments
                                  ):  # check if item is wing segment
                for i in range(0, num_seg):
                    key = 'section_' + str(i)
                    #                print item
                    segment = getattr(item, key)
                    #                print segment.tag
                    segment.percent_span_location = psl[i]
                    segment.root_chord_percent = rcp[i]
                    segment.dihedral_outboard = do[i] * Units.deg
                    segment.sweeps.quarter_chord = sqc[i] * Units.deg
                    segment.thickness_to_chord = ttc[i]
#                print 'section'+str(i) + '\n'+str(segment)

# Size solar panel area
    wing_area = vec.reference_area
    spanel = vec.propulsors.network.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.network.motor
    kv = motor.speed_constant
    motor = size_from_kv(motor, kv)

    # diff the new data
    vec.store_diff()
    return nexus
示例#9
0
def vehicle_setup():

    # ------------------------------------------------------------------
    #   Initialize the Vehicle
    # ------------------------------------------------------------------

    vehicle = SUAVE.Vehicle()
    vehicle.tag = 'Tecnam_P2006TElectric'

    # ------------------------------------------------------------------
    #   Vehicle-level Properties
    # ------------------------------------------------------------------

    # mass properties
    vehicle.mass_properties.max_takeoff = 1400 * Units.kilogram
    vehicle.mass_properties.takeoff = 1400 * Units.kilogram
    vehicle.mass_properties.operating_empty = 1000 * Units.kilogram
    vehicle.mass_properties.max_zero_fuel = 1400 * Units.kilogram
    vehicle.mass_properties.cargo = 80 * Units.kilogram

    # envelope properties
    vehicle.envelope.ultimate_load = 5.7
    vehicle.envelope.limit_load = 3.8

    # basic parameters
    vehicle.reference_area = 64.4 * Units['meters**2']
    vehicle.passengers = 4
    vehicle.systems.control = "fully powered"
    vehicle.systems.accessories = "medium range"

    # ------------------------------------------------------------------
    #  Landing Gear
    # ------------------------------------------------------------------
    # used for noise calculations
    landing_gear = SUAVE.Components.Landing_Gear.Landing_Gear()
    landing_gear.tag = "main_landing_gear"

    landing_gear.main_tire_diameter = 0.423 * Units.m
    landing_gear.nose_tire_diameter = 0.3625 * Units.m
    landing_gear.main_strut_length = 0.4833 * Units.m
    landing_gear.nose_strut_length = 0.3625 * Units.m
    landing_gear.main_units = 2  #number of main landing gear units
    landing_gear.nose_units = 1  #number of nose landing gear
    landing_gear.main_wheels = 1  #number of wheels on the main landing gear
    landing_gear.nose_wheels = 1  #number of wheels on the nose landing gear
    vehicle.landing_gear = landing_gear

    # ------------------------------------------------------------------
    #  Fuselage
    # ------------------------------------------------------------------

    fuselage = SUAVE.Components.Fuselages.Fuselage()
    fuselage.tag = 'fuselage'

    fuselage.number_coach_seats = vehicle.passengers
    fuselage.seats_abreast = 2
    fuselage.seat_pitch = 0.995 * Units.meter
    fuselage.fineness.nose = 1.27
    fuselage.fineness.tail = 1  #3.31
    fuselage.lengths.nose = 1.16 * Units.meter
    fuselage.lengths.tail = 4.637 * Units.meter
    fuselage.lengths.cabin = 2.653 * Units.meter
    fuselage.lengths.total = 8.45 * Units.meter
    fuselage.lengths.fore_space = 0.0 * Units.meter
    fuselage.lengths.aft_space = 0.0 * Units.meter
    fuselage.width = 1.22 * Units.meter
    fuselage.heights.maximum = 1.41 * Units.meter
    fuselage.effective_diameter = 2 * Units.meter
    fuselage.areas.side_projected = 7.46 * Units['meters**2']
    fuselage.areas.wetted = 25.0 * Units['meters**2']
    fuselage.areas.front_projected = 1.54 * Units['meters**2']
    fuselage.differential_pressure = 0.0 * Units.pascal  # Maximum differential pressure

    fuselage.heights.at_quarter_length = 1.077 * Units.meter
    fuselage.heights.at_three_quarters_length = 0.5 * Units.meter  #0.621 * Units.meter
    fuselage.heights.at_wing_root_quarter_chord = 1.41 * Units.meter

    # add to vehicle
    vehicle.append_component(fuselage)

    # ------------------------------------------------------------------
    #   Main Wing
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Main_Wing()
    wing.tag = 'main_wing'

    wing.thickness_to_chord = 0.15
    wing.taper = 0.7016
    wing.spans.projected = 9.631680 * Units.meter
    wing.chords.root = 0.7559040 * Units.meter
    wing.chords.tip = wing.chords.root * wing.taper
    wing.chords.mean_aerodynamic = 0.6 * Units.meter
    wing.areas.reference = (wing.chords.root +
                            wing.chords.tip) * wing.spans.projected / 2
    wing.twists.root = 0. * Units.degrees
    wing.twists.tip = 0. * Units.degrees
    wing.dihedral = 1. * Units.degrees
    wing.origin = [2.986, 0, 1.077]  # meters
    wing.sweeps.leading_edge = 1.9 * Units.deg
    wing.aspect_ratio = (wing.spans.projected *
                         wing.spans.projected) / wing.areas.reference
    wing.span_efficiency = 0.99 * (
        1 - 0.0407 * (fuselage.width / wing.spans.projected) - 1.792 *
        ((fuselage.width / wing.spans.projected)**2))
    wing.vertical = False
    wing.symmetric = True
    wing.high_lift = True
    wing.dynamic_pressure_ratio = 1.0

    # ------------------------------------------------------------------
    #   Flaps
    # ------------------------------------------------------------------

    wing.flaps.chord = 0.20
    wing.flaps.span_start = 0.1053
    wing.flaps.span_end = 0.6842
    wing.flaps.type = 'single_slotted'

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------
    #  Horizontal Stabilizer
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'horizontal_stabilizer'

    wing.aspect_ratio = 4.193
    wing.sweeps.quarter_chord = 0.0 * Units.deg
    wing.thickness_to_chord = 0.12
    wing.taper = 1.0
    wing.span_efficiency = 0.733
    wing.spans.projected = 3.3 * Units.meter
    wing.chords.root = 0.787 * Units.meter
    wing.chords.tip = 0.787 * Units.meter
    wing.chords.mean_aerodynamic = (wing.chords.root * (2.0 / 3.0) *
                                    ((1.0 + wing.taper + wing.taper**2.0) /
                                     (1.0 + wing.taper))) * Units.meter
    wing.areas.reference = 2.5971 * Units['meters**2']
    wing.areas.exposed = 4.0 * Units['meters**2']
    wing.areas.wetted = 4.0 * Units['meters**2']
    wing.twists.root = 0.0 * Units.degrees
    wing.twists.tip = 0.0 * Units.degrees
    wing.origin = [7.789, 0.0, 0.3314]  # meters
    wing.vertical = False
    wing.symmetric = True
    wing.dynamic_pressure_ratio = 0.9

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------
    #   Vertical Stabilizer
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'vertical_stabilizer'

    wing.aspect_ratio = 1.407
    wing.sweeps.quarter_chord = 38.75 * Units.deg
    wing.thickness_to_chord = 0.12
    wing.taper = 1.0
    wing.span_efficiency = -0.107
    wing.spans.projected = 1.574 * Units.meter
    wing.chords.root = 1.2 * Units.meter
    wing.chords.tip = 0.497 * Units.meter
    wing.chords.mean_aerodynamic = (wing.chords.root * (2.0 / 3.0) *
                                    ((1.0 + wing.taper + wing.taper**2.0) /
                                     (1.0 + wing.taper))) * Units.meter
    wing.areas.reference = 1.761 * Units['meters**2']
    wing.twists.root = 0.0 * Units.degrees
    wing.twists.tip = 0.0 * Units.degrees
    wing.origin = [7.25, 0, 0.497]  # meters
    wing.vertical = True
    wing.symmetric = False
    wing.t_tail = False
    wing.dynamic_pressure_ratio = 1.0

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------
    #  Propellers Powered By Batteries
    # ------------------------------------------------------------------

    # build network
    net = SUAVE.Components.Energy.Networks.Lift_Forward_Propulsor_Network_Lo_Fi(
    )

    net.nacelle_diameter_lift = 0.08 * Units.meters
    net.nacelle_diameter_forward = 0.1732 * Units.meters
    net.engine_length_lift = 0.47244 * Units.meters
    net.engine_length_forward = 1.2 * Units.meters
    net.number_of_engines_lift = 12
    net.number_of_engines_forward = 2
    net.thrust_angle_lift = 0.0 * Units.degrees
    net.thrust_angle_forward = 0.0 * Units.degrees
    net.voltage = 461.
    net.areas_forward = Data()
    net.areas_forward.wetted = 1.1 * np.pi * net.nacelle_diameter_forward * net.engine_length_forward
    net.areas_lift = Data()
    net.areas_lift.wetted = 1.1 * np.pi * net.nacelle_diameter_forward * net.engine_length_lift

    # Component 1 - Tip ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95  # Gundlach for brushless motors
    net.esc_forward = esc

    # Component 1 - High Lift ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95  # Gundlach for brushless motors
    net.esc_lift = esc

    # Component 2 Tip Propeller
    prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
    prop.propulsive_efficiency = 0.95
    prop.tip_radius = 0.762 * Units.meter
    net.propeller_forward = prop

    # Component 2 High Lift Propeller
    prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
    prop.propulsive_efficiency = 0.95
    prop.tip_radius = 0.2880360 * Units.meter
    net.propeller_lift = prop

    # Component 3 Tip Motor
    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    kv = 300. * Units['rpm/volt']  # RPM/volt is standard
    motor.expected_current = 1000.0
    motor = size_from_kv(motor, kv)
    motor.gear_ratio = 1.  # Gear ratio, no gearbox
    motor.gearbox_efficiency = 1.  # Gear box efficiency, no gearbox
    motor.motor_efficiency = 0.95
    net.motor_forward = motor

    # Component 3 High Lift Motor
    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    kv = 3691. * Units['rpm/volt']  # RPM/volt is standard
    motor.expected_current = 1000.0
    motor = size_from_kv(motor, kv)
    motor.gear_ratio = 1.  # Gear ratio, no gearbox
    motor.gearbox_efficiency = 1.  # Gear box efficiency, no gearbox
    motor.motor_efficiency = 0.95
    net.motor_lift = motor

    # Component 4 - the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw = 50. * Units.watts
    payload.mass_properties.mass = 5.0 * Units.kg
    net.payload = payload

    # Component 5 - the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 50. * Units.watts
    net.avionics = avionics

    # Component 6 - the Battery
    bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion(
    )
    bat.mass_properties.mass = 358.33 * Units.kg
    bat.specific_energy = 192.84 * Units.Wh / Units.kg
    bat.specific_power = 0.837 * Units.kW / Units.kg
    bat.resistance = 0.0153
    bat.max_voltage = 11.078
    initialize_from_mass(bat, bat.mass_properties.mass)
    net.battery = bat

    # ------------------------------------------------------------------
    #   Vehicle Definition Complete
    # ------------------------------------------------------------------

    # add the energy network to the vehicle
    vehicle.append_component(net)

    #print vehicle

    return vehicle
示例#10
0
def vehicle_setup():
    
    # ------------------------------------------------------------------
    #   Initialize the Vehicle
    # ------------------------------------------------------------------    
    
    vehicle = SUAVE.Vehicle()
    vehicle.tag = 'tail_sitter'
    
    # ------------------------------------------------------------------
    #   Vehicle-level Properties
    # ------------------------------------------------------------------    
    # mass properties
    vehicle.mass_properties.takeoff         = 0.82 * Units.kg
    vehicle.mass_properties.operating_empty = 0.82 * Units.kg
    vehicle.mass_properties.max_takeoff     = 0.82 * Units.kg
    
    # basic parameters
    vehicle.reference_area                  = 0.1668 
    
    # ------------------------------------------------------------------        
    #   Main Wing
    # ------------------------------------------------------------------   

    wing = SUAVE.Components.Wings.Main_Wing()
    wing.tag = 'main_wing'
    
    wing.areas.reference         = vehicle.reference_area
    wing.spans.projected         = 1.03 * Units.m
    wing.aspect_ratio            = (wing.spans.projected**2)/wing.areas.reference 
    wing.sweeps.quarter_chord    = 5.0 * Units.deg
    wing.thickness_to_chord      = 0.12
    wing.taper                   = 1.0
    wing.dynamic_pressure_ratio  = 1.0
    wing.chords.mean_aerodynamic = 0.162 * Units.m
    wing.twists.root             = 0.0 * Units.degrees
    wing.twists.tip              = 0.0 * Units.degrees
    wing.high_lift               = False
    wing.vertical                = False
    wing.symmetric               = True

    # add to vehicle
    vehicle.append_component(wing)    

    #------------------------------------------------------------------
    # Propulsor
    #------------------------------------------------------------------
    
    # build network
    net = SUAVE.Components.Energy.Networks.Battery_Propeller()
    net.number_of_propeller_engines = 4.
    net.voltage                     = 12.3
    net.identical_propellers        = True
    
    # Component 1 the ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95 # Gundlach for brushless motors
    net.esc        = esc
    
    # Component 2 the Propeller
    
    # Design the Propeller
    prop = SUAVE.Components.Energy.Converters.Propeller()
    prop.number_of_blades    = 2.0
    prop.freestream_velocity = 15.0 # freestream m/s
    prop.angular_velocity    = 7500. * Units['rpm']
    prop.tip_radius          = 4.    * Units.inch
    prop.hub_radius          = 0.125 * Units.inch
    prop.design_Cl           = 0.7
    prop.design_altitude     = 0.1 * Units.km
    prop.design_power        = 200. * Units.watts
    prop                     = propeller_design(prop)
    
    origins = [[0., 0.15, -0.05], [0., -0.15, -0.05], [0., .35, 0.05], [0., 0.35, 0.05]]
    
    
    for ii in range(4):
        rotor          = deepcopy(prop)
        rotor.tag      = 'propeller'
        rotor.origin   = [origins[ii]]
        net.propellers.append(rotor)    

    # Component 3 the Motor
    motor = SUAVE.Components.Energy.Converters.Motor()
    motor.speed_constant       = 1500. * Units['rpm'] # RPM/volt converted to (rad/s)/volt 
    motor = size_from_kv(motor)
    motor.gear_ratio           = 1.  # Gear ratio
    motor.gearbox_efficiency   = 1.  # Gear box efficiency
    motor.expected_current     = 10. # Expected current
    motor.propeller_radius     = prop.tip_radius

    for ii in range(4):
        rotor_motor = deepcopy(motor)
        rotor_motor.tag    = 'motor'
        rotor_motor.origin = [origins[ii]]
        net.propeller_motors.append(rotor_motor)

    
    # Component 4 the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw           = 0. #Watts 
    payload.mass_properties.mass = 0.0 * Units.kg
    net.payload                  = payload
    
    # Component 5 the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 2. #Watts  
    net.avionics        = avionics      

    # Component 6 the Battery
    bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion()
    bat.mass_properties.mass = 0.17 * Units.kg
    bat.specific_energy      = 175.*Units.Wh/Units.kg
    bat.resistance           = 0.003
    bat.max_voltage          = 11.1
    initialize_from_mass(bat)
    net.battery              = bat
    
    # add the solar network to the vehicle
    vehicle.append_component(net)  

    return vehicle
def main():
   
    #------------------------------------------------------------------
    # Propulsor
    #------------------------------------------------------------------

    # 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()
    net.solar_flux = sun

    # Component 2 the solar panels
    panel = SUAVE.Components.Energy.Converters.Solar_Panel()
    panel.ratio                = 0.9
    panel.area                 = 1.0 * panel.ratio 
    panel.efficiency           = 0.25
    panel.mass_properties.mass = panel.area*(0.60 * Units.kg)
    net.solar_panel            = panel

    # Component 3 the ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95 # Gundlach for brushless motors
    net.esc        = esc

    # Component 5 the Propeller
    prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
    prop.propulsive_efficiency = 0.825
    net.propeller        = prop
    
    # Component 4 the Motor
    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    kv                         = 800. * Units['rpm/volt'] # RPM/volt is standard
    motor                      = size_from_kv(motor, kv)    
    motor.gear_ratio           = 1. # Gear ratio, no gearbox
    motor.gearbox_efficiency   = 1. # Gear box efficiency, no gearbox
    motor.motor_efficiency     = 0.825;
    net.motor                  = motor    

    # Component 6 the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw           = 0. #Watts 
    payload.mass_properties.mass = 0.0 * Units.kg
    net.payload                  = payload

    # Component 7 the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 10. #Watts  
    net.avionics        = avionics      

    # Component 8 the Battery
    bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion()
    bat.mass_properties.mass = 5.0  * Units.kg
    bat.specific_energy      = 250. *Units.Wh/Units.kg
    bat.resistance           = 0.003
    bat.iters                = 0
    initialize_from_mass(bat,bat.mass_properties.mass)
    net.battery              = bat

    #Component 9 the system logic controller and MPPT
    logic = SUAVE.Components.Energy.Distributors.Solar_Logic()
    logic.system_voltage  = 18.5
    logic.MPPT_efficiency = 0.95
    net.solar_logic       = logic
    
    # Setup the conditions to run the network
    state            = Data()
    state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
    state.numerics   = SUAVE.Analyses.Mission.Segments.Conditions.Numerics()
    
    conditions = state.conditions
    numerics   = state.numerics
    
    # Calculate atmospheric properties
    atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
    atmosphere_conditions =  atmosphere.compute_values(1000.*Units.ft)
    
    rho = atmosphere_conditions.density[0,:]
    a   = atmosphere_conditions.speed_of_sound[0,:]
    mu  = atmosphere_conditions.dynamic_viscosity[0,:]
    T   = atmosphere_conditions.temperature[0,:]

    conditions.propulsion.throttle            = np.array([[1.0],[1.0]])
    conditions.freestream.velocity            = np.array([[1.0],[1.0]])
    conditions.freestream.density             = np.array([rho,rho])
    conditions.freestream.dynamic_viscosity   = np.array([mu, mu])
    conditions.freestream.speed_of_sound      = np.array([a, a])
    conditions.freestream.altitude            = np.array([[1000.0],[1000.0]])
    conditions.propulsion.battery_energy      = bat.max_energy*np.ones_like(conditions.freestream.altitude)
    conditions.frames.body.inertial_rotations = np.zeros([2,3])
    conditions.frames.inertial.time           = np.array([[0.0],[1.0]])
    numerics.time.integrate                   = np.array([[0, 0],[0, 1]])
    numerics.time.differentiate               = np.array([[0, 0],[0, 1]])
    conditions.frames.planet.start_time       = time.strptime("Sat, Jun 21 06:00:00  2014", "%a, %b %d %H:%M:%S %Y",) 
    conditions.frames.planet.latitude         = np.array([[0.0],[0.0]])
    conditions.frames.planet.longitude        = np.array([[0.0],[0.0]])
    conditions.freestream.temperature         = np.array([T, T])
    conditions.frames.body.transform_to_inertial = np.array([[[ 1.,  0.,  0.],
                                                              [ 0.,  1.,  0.],
                                                              [ 0.,  0.,  1.]],
                                                             [[ 1.,  0.,  0.],
                                                              [ 0.,  1.,  0.],
                                                              [ 0.,  0.,  1.]]])   
    # Run the network and print the results
    results = net(state)
    F       = results.thrust_force_vector
    
    # Truth results
    truth_F   = [[ 68.78277813   ], [ 68.78277813     ]]
    truth_i   = [[ 5.75011436    ], [ 5.75011436      ]]
    truth_rpm = [[ 14390.30435183], [ 14390.30435183  ]]
    truth_bat = [[ 4500000.      ], [ 4499883.5041616 ]]
    
    error = Data()
    error.Thrust = np.max(np.abs(F[:,0]-truth_F))
    error.RPM = np.max(np.abs(conditions.propulsion.rpm-truth_rpm))
    error.Current  = np.max(np.abs(conditions.propulsion.current-truth_i))
    error.Battery = np.max(np.abs(bat.current_energy-truth_bat))
    
    print(error)
    
    for k,v in list(error.items()):
        assert(np.abs(v)<1e-6)        
    
    return
示例#12
0
def base_setup():
    
    # ------------------------------------------------------------------
    #   Initialize the Vehicle
    # ------------------------------------------------------------------    

    vehicle = SUAVE.Vehicle()
    vehicle.tag = 'Solar'

    # ------------------------------------------------------------------
    #   Vehicle-level Properties
    # ------------------------------------------------------------------    
    # mass properties
    vehicle.mass_properties.takeoff         = 6.75 * Units.kg
    vehicle.mass_properties.operating_empty = 6.75 * Units.kg
    vehicle.mass_properties.max_takeoff     = 6.75 * Units.kg 

    # basic parameters
    vehicle.reference_area                    = 1.0       
    vehicle.envelope.ultimate_load            = 2.0
    vehicle.envelope.limit_load               = 1.5
    vehicle.envelope.maximum_dynamic_pressure = 115.*1.25 * Units.pascals #Max q

    # ------------------------------------------------------------------        
    #   Main Wing
    # ------------------------------------------------------------------   

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'main_wing'

    wing.areas.reference         = vehicle.reference_area
    wing.spans.projected         = 40.0 * Units.meters
    wing.aspect_ratio            = (wing.spans.projected**2)/wing.areas.reference 
    wing.sweeps.quarter_chord    = 0.0 * Units.deg
    wing.symmetric               = True
    wing.thickness_to_chord      = 0.12
    wing.taper                   = 1.0
    wing.vertical                = False
    wing.high_lift               = True 
    wing.dynamic_pressure_ratio  = 1.0
    wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected
    wing.span_efficiency         = 0.98 
    wing.twists.root             = 0.0 * Units.degrees
    wing.twists.tip              = 0.0 * Units.degrees
    wing.highlift                = False  
    wing.vertical                = False 
    wing.number_ribs             = 26.
    wing.number_end_ribs         = 2.
    wing.transition_x_upper      = 0.6
    wing.transition_x_lower      = 1.0
    wing.origin                  = [3.0,0.0,0.0]

    # add to vehicle
    vehicle.append_component(wing)

    # ------------------------------------------------------------------        
    #  Horizontal Stabilizer
    # ------------------------------------------------------------------        

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'horizontal_stabilizer'

    wing.aspect_ratio         = 10. 
    wing.sweeps.quarter_chord = 0 * Units.deg
    wing.thickness_to_chord   = 0.12
    wing.taper                = 1.0
    wing.span_efficiency      = 0.95 
    wing.areas.reference      = vehicle.reference_area * .15
    wing.areas.wetted         = 2.0 * wing.areas.reference
    wing.areas.exposed        = 0.8 * wing.areas.wetted
    wing.areas.affected       = 0.6 * wing.areas.wetted       
    wing.spans.projected      = np.sqrt(wing.aspect_ratio*wing.areas.reference)
    wing.twists.root          = 0.0 * Units.degrees
    wing.twists.tip           = 0.0 * Units.degrees      

    wing.vertical                = False 
    wing.symmetric               = True
    wing.dynamic_pressure_ratio  = 0.9      
    wing.number_ribs             = 5.0
    wing.chords.root             = wing.areas.reference/wing.spans.projected
    wing.chords.tip              = wing.areas.reference/wing.spans.projected
    wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected  
    wing.origin                  = [10.,0.0,0.0]

    # add to vehicle
    vehicle.append_component(wing)    

    # ------------------------------------------------------------------
    #   Vertical Stabilizer
    # ------------------------------------------------------------------

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'vertical_stabilizer'    

    wing.aspect_ratio         = 10.       
    wing.sweeps.quarter_chord = 0 * Units.deg
    wing.thickness_to_chord   = 0.12
    wing.taper                = 1.0
    wing.span_efficiency      = 0.97
    wing.areas.reference      = vehicle.reference_area * 0.1
    wing.spans.projected      = np.sqrt(wing.aspect_ratio*wing.areas.reference)

    wing.chords.root             = wing.areas.reference/wing.spans.projected
    wing.chords.tip              = wing.areas.reference/wing.spans.projected
    wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected
    wing.areas.wetted            = 2.0 * wing.areas.reference
    wing.areas.exposed           = 0.8 * wing.areas.wetted
    wing.areas.affected          = 0.6 * wing.areas.wetted    
    wing.twists.root             = 0.0 * Units.degrees
    wing.twists.tip              = 0.0 * Units.degrees  
    wing.origin                  = [10.,0.0,0.0]      
    wing.symmetric               = True          
    wing.vertical                = True 
    wing.t_tail                  = False
    wing.dynamic_pressure_ratio  = 1.0
    wing.number_ribs             = 5.

    # add to vehicle
    vehicle.append_component(wing)  

    #------------------------------------------------------------------
    # Propulsor
    #------------------------------------------------------------------

    # 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()
    net.solar_flux = sun

    # Component 2 the solar panels
    panel = SUAVE.Components.Energy.Converters.Solar_Panel()
    panel.ratio                = 0.9
    panel.area                 = vehicle.reference_area * panel.ratio 
    panel.efficiency           = 0.25
    panel.mass_properties.mass = panel.area*(0.60 * Units.kg)
    net.solar_panel            = panel

    # Component 3 the ESC
    esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
    esc.efficiency = 0.95 # Gundlach for brushless motors
    net.esc        = esc

    # Component 5 the Propeller
    prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
    prop.propulsive_efficiency = 0.825
    net.propeller        = prop
    
    # Component 4 the Motor
    motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
    kv                         = 800. * Units['rpm/volt'] # RPM/volt is standard
    motor                      = size_from_kv(motor, kv)    
    motor.gear_ratio           = 1. # Gear ratio, no gearbox
    motor.gearbox_efficiency   = 1. # Gear box efficiency, no gearbox
    motor.motor_efficiency     = 0.825;
    net.motor                  = motor    

    # Component 6 the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw           = 0. #Watts 
    payload.mass_properties.mass = 0.0 * Units.kg
    net.payload                  = payload

    # Component 7 the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 10. #Watts  
    net.avionics        = avionics      

    # Component 8 the Battery
    bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion()
    bat.mass_properties.mass = 5.0  * Units.kg
    bat.specific_energy      = 250. *Units.Wh/Units.kg
    bat.resistance           = 0.003
    bat.iters                = 0
    initialize_from_mass(bat,bat.mass_properties.mass)
    net.battery              = bat

    #Component 9 the system logic controller and MPPT
    logic = SUAVE.Components.Energy.Distributors.Solar_Logic()
    logic.system_voltage  = 18.5
    logic.MPPT_efficiency = 0.95
    net.solar_logic       = logic

    # add the solar network to the vehicle
    vehicle.append_component(net)  

    return vehicle