当前位置: 首页>>代码示例>>Python>>正文


Python Data.V方法代码示例

本文整理汇总了Python中SUAVE.Structure.Data.V方法的典型用法代码示例。如果您正苦于以下问题:Python Data.V方法的具体用法?Python Data.V怎么用?Python Data.V使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SUAVE.Structure.Data的用法示例。


在下文中一共展示了Data.V方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compute_energies

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import V [as 别名]
def compute_energies(results,summary=False):

    # evaluate each segment 
    for i in range(len(results.Segments)):

        segment = results.Segments[i]
        eta=segment.conditions.propulsion.throttle[:,0]
        state = Data()
        state.q  = segment.conditions.freestream.dynamic_pressure[:,0]
        state.g0 = segment.conditions.freestream.gravity[:,0]
        state.V  = segment.conditions.freestream.velocity[:,0]
        state.M  = segment.conditions.freestream.mach_number[:,0]
        state.T  = segment.conditions.freestream.temperature[:,0]
        state.p  = segment.conditions.freestream.pressure[:,0]
        
        
        segment.P_fuel, segment.P_e = segment.config.Propulsors.power_flow(eta,state)
        
        # time integration operator
        '''
        print segment.numerics
        I = segment.numerics.integrate_time

        # raw propellant energy consumed 
        segment.energy.propellant = np.dot(I,segment.P_fuel)[-1]

        # raw electrical energy consumed  
        segment.energy.electric = np.dot(I,segment.P_e)[-1]

        # energy to gravity 
        segment.energy.gravity = np.dot(I,segment.m*segment.g*segment.vectors.V[:,2])[-1]   # J

        # energy to drag
        segment.energy.drag = np.dot(I,segment.D*segment.V)[-1]                             # J

        if summary:
            print " "
            print "####### Energy Summary: Segment " + str(i) + " #######"
            print " "
            print "Propellant energy used = " + str(segment.energy.propellant/1e6) + " MJ"
            print "Electrical energy used = " + str(segment.energy.electric/1e6) + " MJ"
            print "Energy lost to gravity = " + str(segment.energy.gravity/1e6) + " MJ"
            print "Energy lost to drag    = " + str(segment.energy.drag/1e6) + " MJ"
            print " "
            print "#########################################"
            print " "
        '''
    return        
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:50,代码来源:compute_energies.py

示例2: estimate_take_off_field_length

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import V [as 别名]
def estimate_take_off_field_length(vehicle,config,airport):
    """ SUAVE.Methods.Performance.estimate_take_off_field_length(vehicle,config,airport):
        Computes the takeoff field length for a given vehicle condition in a given airport

        Inputs:
            vehicle	 - SUAVE type vehicle

            config   - data dictionary with fields:
                Mass_Props.m_takeoff       - Takeoff weight to be evaluated
                S                          - Wing Area
                V2_VS_ratio                - Ratio between V2 and Stall speed
                                             [optional. Default value = 1.20]
                takeoff_constants          - Coefficients for takeoff field lenght equation
                                             [optional. Default values: PASS method]
                maximum_lift_coefficient   - Maximum lift coefficient for the config
                                             [optional. Calculated if not informed]

    airport   - SUAVE type airport data, with followig fields:
                atmosphere                  - Airport atmosphere (SUAVE type)
                altitude                    - Airport altitude
                delta_isa                   - ISA Temperature deviation


        Outputs:
            takeoff_field_length            - Takeoff field length


        Assumptions:
            Correlation based.

    """

    # ==============================================
        # Unpack
    # ==============================================
    atmo            = airport.atmosphere
    altitude        = airport.altitude * Units.ft
    delta_isa       = airport.delta_isa
    weight          = config.Mass_Props.m_takeoff
    reference_area  = config.S
    try:
        V2_VS_ratio = config.V2_VS_ratio
    except:
        V2_VS_ratio = 1.20

    # ==============================================
    # Computing atmospheric conditions
    # ==============================================
    p0, T0, rho0, a0, mew0 = atmo.compute_values(0)
    p , T , rho , a , mew  = atmo.compute_values(altitude)
    T_delta_ISA = T + delta_isa
    sigma_disa = (p/p0) / (T_delta_ISA/T0)
    rho = rho0 * sigma_disa
    a_delta_ISA = atmo.gas.compute_speed_of_sound(T_delta_ISA)
    mew = 1.78938028e-05 * ((T0 + 120) / T0 ** 1.5) * ((T_delta_ISA ** 1.5) / (T_delta_ISA + 120))
    sea_level_gravity = atmo.planet.sea_level_gravity

    # ==============================================
    # Determining vehicle maximum lift coefficient
    # ==============================================
    try:   # aircraft maximum lift informed by user
        maximum_lift_coefficient = config.maximum_lift_coefficient
    except:
        # Using semi-empirical method for maximum lift coefficient calculation
        from SUAVE.Methods.Aerodynamics.Lift.High_lift_correlations import compute_max_lift_coeff

        # Condition to CLmax calculation: 90KTAS @ 10000ft, ISA
        p_stall , T_stall , rho_stall , a_stall , mew_stall  = atmo.compute_values(10000. * Units.ft)
        conditions = Data()
        conditions.rho = rho_stall
        conditions.mew = mew_stall
        conditions.V = 90. * Units.knots
        try:
            maximum_lift_coefficient, induced_drag_high_lift = compute_max_lift_coeff(config,conditions)
            config.maximum_lift_coefficient = maximum_lift_coefficient
        except:
            raise ValueError, "Maximum lift coefficient calculation error. Please, check inputs"

    # ==============================================
    # Computing speeds (Vs, V2, 0.7*V2)
    # ==============================================
    stall_speed = (2 * weight * sea_level_gravity / (rho * reference_area * maximum_lift_coefficient)) ** 0.5
    V2_speed    = V2_VS_ratio * stall_speed
    speed_for_thrust  = 0.70 * V2_speed

    # ==============================================
    # Determining vehicle number of engines
    # ==============================================
    engine_number = 0.
    for propulsor in vehicle.Propulsors : # may have than one propulsor
        engine_number += propulsor.no_of_engines
    if engine_number == 0:
        raise ValueError, "No engine found in the vehicle"

    # ==============================================
    # Getting engine thrust
    # ==============================================
    #state = Data()
    #state.q  = np.atleast_1d(0.5 * rho * speed_for_thrust**2)
    #state.g0 = np.atleast_1d(sea_level_gravity)
#.........这里部分代码省略.........
开发者ID:thearn,项目名称:SUAVE,代码行数:103,代码来源:estimate_take_off_field_length.py

示例3: estimate_landing_field_length

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import V [as 别名]
def estimate_landing_field_length(vehicle,config,airport):
    """ SUAVE.Methods.Performance.estimate_landing_field_length(vehicle,config,airport):
        Computes the landing field length for a given vehicle condition in a given airport

        Inputs:
            vehicle	 - SUAVE type vehicle

            config   - data dictionary with fields:
                Mass_Props.m_landing       - Landing weight to be evaluated
                S                          - Wing Area
                Vref_VS_ratio              - Ratio between Approach Speed and Stall speed
                                             [optional. Default value = 1.23]
                maximum_lift_coefficient   - Maximum lift coefficient for the config
                                             [optional. Calculated if not informed]

    airport   - SUAVE type airport data, with followig fields:
                atmosphere                  - Airport atmosphere (SUAVE type)
                altitude                    - Airport altitude
                delta_isa                   - ISA Temperature deviation


        Outputs:
            landing_field_length            - Landing field length


        Assumptions:
      		- Landing field length calculated according to Torenbeek, E., "Advanced
    Aircraft Design", 2013 (equation 9.25)
            - Considering average aav/g values of two-wheel truck (0.40)
    """

    # ==============================================
        # Unpack
    # ==============================================
    atmo            = airport.atmosphere
    altitude        = airport.altitude * Units.ft
    delta_isa       = airport.delta_isa
    weight          = config.Mass_Props.m_landing
    reference_area  = config.S
    try:
        Vref_VS_ratio = config.Vref_VS_ratio
    except:
        Vref_VS_ratio = 1.23

    # ==============================================
    # Computing atmospheric conditions
    # ==============================================
    p0, T0, rho0, a0, mew0 = atmo.compute_values(0)
    p , T , rho , a , mew  = atmo.compute_values(altitude)
    T_delta_ISA = T + delta_isa
    sigma_disa = (p/p0) / (T_delta_ISA/T0)
    rho = rho0 * sigma_disa
    a_delta_ISA = atmo.gas.compute_speed_of_sound(T_delta_ISA)
    mew = 1.78938028e-05 * ((T0 + 120) / T0 ** 1.5) * ((T_delta_ISA ** 1.5) / (T_delta_ISA + 120))
    sea_level_gravity = atmo.planet.sea_level_gravity

    # ==============================================
    # Determining vehicle maximum lift coefficient
    # ==============================================
    try:   # aircraft maximum lift informed by user
        maximum_lift_coefficient = config.maximum_lift_coefficient
    except:
        # Using semi-empirical method for maximum lift coefficient calculation
        from SUAVE.Methods.Aerodynamics.Lift.High_lift_correlations import compute_max_lift_coeff

        # Condition to CLmax calculation: 90KTAS @ 10000ft, ISA
        p_stall , T_stall , rho_stall , a_stall , mew_stall  = atmo.compute_values(10000. * Units.ft)
        conditions = Data()
        conditions.rho = rho_stall
        conditions.mew = mew_stall
        conditions.V = 90. * Units.knots
        try:
            maximum_lift_coefficient, induced_drag_high_lift = compute_max_lift_coeff(config,conditions)
            config.maximum_lift_coefficient = maximum_lift_coefficient
        except:
            raise ValueError, "Maximum lift coefficient calculation error. Please, check inputs"

    # ==============================================
    # Computing speeds (Vs, Vref)
    # ==============================================
    stall_speed  = (2 * weight * sea_level_gravity / (rho * reference_area * maximum_lift_coefficient)) ** 0.5
    Vref         = stall_speed * Vref_VS_ratio

    # ========================================================================================
    # Computing landing distance, according to Torenbeek equation
    #     Landing Field Length = k1 + k2 * Vref**2
    # ========================================================================================

    # Defining landing distance equation coefficients
    try:
        landing_constants = config.landing_constants # user defined
    except:  # default values - According to Torenbeek book
        landing_constants = np.zeros(3)
        landing_constants[0] = 250.
        landing_constants[1] =   0.
        landing_constants[2] =   2.485  / sea_level_gravity  # Two-wheels truck : [ (1.56 / 0.40 + 1.07) / (2*sea_level_gravity) ]
##        landing_constants[2] =   2.9725 / sea_level_gravity  # Four-wheels truck: [ (1.56 / 0.32 + 1.07) / (2*sea_level_gravity) ]

    # Calculating landing field length
    landing_field_length = 0.
#.........这里部分代码省略.........
开发者ID:thearn,项目名称:SUAVE,代码行数:103,代码来源:estimate_landing_field_length.py

示例4: __call__

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import V [as 别名]
    def __call__(self,eta,conditions):
        
        segment=Data()
        segment.q  = conditions.freestream.dynamic_pressure[:,0]
        segment.g0 = conditions.freestream.gravity[:,0]
        segment.V  = conditions.freestream.velocity[:,0]
        segment.M  = conditions.freestream.mach_number[:,0]
        segment.T  = conditions.freestream.temperature[:,0]
        segment.p  = conditions.freestream.pressure[:,0]
        
        F    = np.zeros_like(eta)
        mdot = np.zeros_like(eta)
        P    = np.zeros_like(eta)
        
        for propulsor in self.values():
            CF, Isp, etaPe = propulsor(eta,segment)

            # get or determine intake area
            A = propulsor.get_area()

            # compute data
            F += CF*segment.q*A                             # N
            
            # propellant-based
            if np.isscalar(Isp):
                if Isp != 0.0:
                    mdot += F/(Isp*segment.g0)              # kg/s
                    
            else:
                mask = (Isp != 0.0)
                mdot[mask] += F[mask]/(Isp[mask]*segment.g0)   # kg/s
                
            # electric-based
            if np.isscalar(etaPe):
                if etaPe != 0.0:
                    P += F*segment.V/etaPe                  # W
                    
                   #Account for mass gain of Li-air battery
                    try:
                        self.battery
                    except AttributeError:
                        
                        if propulsor.battery.type=='Li-Air': 
                            
                            for i in range(len(P)):
                                if propulsor.battery.MaxPower>P[i]:
                                    [Ploss,Mdot]=propulsor.battery(P[i],.01 )       #choose small dt here (has not been solved for yet); its enough to find mass rate gain of battery
                                else:
                                    [Ploss,Mdot]=propulsor.battery(propulsor.battery.MaxPower,.01 )
                                mdot[i]+=Mdot.real
                                
                                
                                
                                
                   
            else:
                mask = (etaPe != 0.0)
                P += F[mask]*segment.V[mask]/etaPe[mask]    # W
            #print mdot   
            
        return F, mdot, P
开发者ID:thearn,项目名称:SUAVE,代码行数:63,代码来源:Propulsor.py

示例5: define_mission

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import V [as 别名]
def define_mission(vehicle):
    
    # ------------------------------------------------------------------
    #   Initialize the Mission
    # ------------------------------------------------------------------

    mission = SUAVE.Attributes.Missions.Mission()
    mission.tag = 'EMBRAER_E190AR test mission'

    # atmospheric model
    atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    planet = SUAVE.Attributes.Planets.Earth()



    # ------------------------------------------------------------------
    #   Takeoff Segment
    # ------------------------------------------------------------------
    
    segment = Takeoff()
    segment.tag = "Takeoff Roll"
    
    # connect vehicle configuration
    segment.config = vehicle.Configs.takeoff
    
    # define segment attributes
    airport_altitude       = 0.0 * Units.km
    segment.atmosphere     = atmosphere
    segment.planet         = planet
    segment.altitude       = airport_altitude

    #Determine liftoff speed (which will be the segment end velocity)
    g_to      = planet.sea_level_gravity
    p_to, T_to, rho_to, a_to, mew_to = atmosphere.compute_values(segment.altitude)
    v_rot_assumed  = 175 * Units.mile / Units.hour
    rot_conditions = Data()
    rot_conditions.V = v_rot_assumed
    rot_conditions.mew = mew_to
    rot_conditions.rho = rho_to
    CL_max = SUAVE.Methods.Aerodynamics.Lift.High_lift_correlations.compute_max_lift_coeff(vehicle,rot_conditions)[0][0]
    v_mu   = (vehicle.Mass_Props.m_takeoff*g_to / (0.5*rho_to*CL_max*vehicle.S))**0.5
    v_rot  = 1.1 * v_mu
    print v_rot

    segment.velocity_start = 0.0   * Units['m/s']
    segment.velocity_end   = v_rot

    # add to misison
    mission.append_segment(segment)

    
    
    # ------------------------------------------------------------------
    #   First Climb Segment: Constant Speed, Constant Climb Rate
    # ------------------------------------------------------------------
    
    segment =  SUAVE.Attributes.Missions.Segments.Climb.Constant_Speed_Constant_Rate()
    segment.tag = "Climb to 35'"
    
    # connect vehicle configuration
    segment.config = vehicle.Configs.takeoff
    
    # define segment attributes
    segment.atmosphere     = atmosphere
    segment.planet         = planet  
  
    segment.altitude_start = airport_altitude
    segment.altitude_end   = airport_altitude + 35. * Units.feet
    segment.climb_rate     = 3000. * Units['ft/min']
    segment.air_speed      = 1.2 * v_mu * Units['m/s']
    print segment.air_speed, segment.climb_rate
    
    # add to misison
    mission.append_segment(segment)

    
    # ------------------------------------------------------------------    
    #   Mission definition complete    
    # ------------------------------------------------------------------
    
    return mission
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:83,代码来源:test_takeoff_landing_E190.py


注:本文中的SUAVE.Structure.Data.V方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。