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


Python Data.frames方法代码示例

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


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

示例1: main

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import frames [as 别名]
def main():
    
    # Setup and pack inputs, test several cases
    
    conditions = Data()
    conditions.frames = Data()
    conditions.frames.body = Data()    
    conditions.frames.planet = Data()
    conditions.frames.inertial = Data()
    conditions.freestream = Data()
    conditions.frames.body.inertial_rotations = np.zeros((4,3))
    conditions.frames.planet.start_time = time.strptime("Thu, Mar 20 12:00:00  2014", "%a, %b %d %H:%M:%S %Y",)
    conditions.frames.planet.latitude = np.array([[0.0],[35],[70],[0.0]])
    conditions.frames.planet.longitude = np.array([[0.0],[0.0],[0.0],[0.0]])
    conditions.frames.body.inertial_rotations[:,0] = np.array([0.0,np.pi/10,np.pi/5,0.0]) # Phi
    conditions.frames.body.inertial_rotations[:,1] = np.array([0.0,np.pi/10,np.pi/5,0.0]) # Theta
    conditions.frames.body.inertial_rotations[:,2] = np.array([0.0,np.pi/2,np.pi,0.0])    # Psi
    conditions.freestream.altitude = np.array([[600000.0],[0.0],[60000],[1000]])
    conditions.frames.inertial.time = np.array([[0.0],[0.0],[0.0],[43200]])
    
    # Call solar radiation
    rad = SUAVE.Components.Energy.Processes.Solar_Radiation()
    fluxes = rad.solar_radiation(conditions)
    
    print('Solar Fluxes')
    print fluxes
    truth_fluxes = [[ 1304.01069749],[ 815.02502004],[  783.55678702],[0.0]]

    
    max_error =  np.max(np.abs(fluxes-truth_fluxes))
    
    assert( max_error < 1e-5 )
    
    return
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:36,代码来源:test_solar_radiation.py

示例2: __defaults__

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import frames [as 别名]
    def __defaults__(self):
        self.tag = 'Base_Segment'
        
        # --- Segment Inputs
        
        # these are the inputs the user will define in the input script
        
        # an example
        ##self.mach_number = 0.7
        #self.mass_initial     = 'previous_segment' ??
        #self.time_initial     = 'previous_segment'
        #self.position_initial = 'previous_segment'
        
        # --- Vehicle Configuration
        
        # a linked copy of the vehicle
        
        self.config = Data()
        
        
        # --- Conditions and Unknowns
        
        # user shouldn't change these in an input script
        # only used for processing / post processing
        # they will be shared with analysis modules and meaningful naming is important
        
        # base array column lengths
        # use a trivial operation to copy the array
        ones_1col = np.ones([1,1])
        ones_2col = np.ones([1,2])
        ones_3col = np.ones([1,3])         
        
        
        # --- Conditions 
        
        # setup conditions
        conditions = Data()
        conditions.frames   = Data()
        conditions.weights  = Data()
        conditions.energies = Data()   
        self.conditions = conditions
        
        # inertial conditions
        conditions.frames.inertial = Data()        
        conditions.frames.inertial.position_vector      = ones_3col * 0
        conditions.frames.inertial.velocity_vector      = ones_3col * 0
        conditions.frames.inertial.acceleration_vector  = ones_3col * 0
        conditions.frames.inertial.total_force_vector   = ones_3col * 0
        conditions.frames.inertial.time                 = ones_1col * 0
        
        # body conditions
        conditions.frames.body = Data()        
        conditions.frames.body.inertial_rotations       = ones_3col * 0
        conditions.frames.body.transform_to_inertial    = np.empty([0,0,0])
        
        # weights conditions
        conditions.weights.total_mass            = ones_1col * 0
        conditions.weights.weight_breakdown      = Data()
        
        # energy conditions
        conditions.energies.total_energy         = ones_1col * 0
        conditions.energies.total_efficiency     = ones_1col * 0
        
        # --- Unknowns
        
        # setup unknowns
        unknowns = Data()
        unknowns.states   = Data()
        unknowns.controls = Data()
        unknowns.finals   = Data()
        self.unknowns = unknowns
        
        # an example
        ## unknowns.states.gamma = ones_1col + 0

        
        # --- Residuals
         
        # setup unknowns
        residuals = Data()
        residuals.states   = Data()
        residuals.controls = Data()
        residuals.finals   = Data()
        self.residuals = residuals
        
        
        # --- Initial Conditions
        
        # this data structure will hold a copy of the last
        #    rows from the conditions of the last segment
        
        self.initials = Data()
        
        
        # --- Numerics
        
        self.numerics = Data()
        self.numerics.tag = 'Solution Numerical Setup'
        
        # discretization
#.........这里部分代码省略.........
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:103,代码来源:Base_Segment.py

示例3: main

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import frames [as 别名]
def main():

    # ------------------------------------------------------------------
    #   Propulsor
    # ------------------------------------------------------------------
    
    # build network
    net = Solar_Network()
    net.number_motors = 1.
    net.nacelle_dia   = 0.2
    
    # 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.area                 = 100 * Units.m
    panel.efficiency           = 0.18
    panel.mass_properties.mass = panel.area*.600
    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
    
    #Propeller design specs
    design_altitude = 0.0 * Units.km
    Velocity        = 10.0  # freestream m/s
    RPM             = 5887
    Blades          = 2.0
    Radius          = .4064
    Hub_Radius      = 0.05
    Design_Cl       = 0.7
    Thrust          = 0.0 #Specify either thrust or power to design for
    Power           = 7500.  #Specify either thrust or power to design for
    
    # Design the Propeller
    prop_attributes = Data()
    prop_attributes.number_blades       = Blades 
    prop_attributes.freestream_velocity = Velocity
    prop_attributes.angular_velocity    = RPM*(2.*np.pi/60.0)
    prop_attributes.tip_radius          = Radius
    prop_attributes.hub_radius          = Hub_Radius
    prop_attributes.design_Cl           = Design_Cl 
    prop_attributes.design_altitude     = design_altitude
    prop_attributes.design_thrust       = Thrust
    prop_attributes.design_power        = Power
    prop_attributes                     = propeller_design(prop_attributes)
    
    # Create and attach this propeller
    prop                 = SUAVE.Components.Energy.Converters.Propeller()
    prop.prop_attributes = prop_attributes
    net.propeller        = prop
    
    # Component 4 the Motor
    motor = SUAVE.Components.Energy.Converters.Motor()
    motor.resistance           = 0.01
    motor.no_load_current      = 8.0
    motor.speed_constant       = 140.*(2.*np.pi/60.) # RPM/volt converted to rad/s     
    motor.propeller_radius     = prop.prop_attributes.tip_radius
    motor.propeller_Cp         = prop.prop_attributes.Cp
    motor.gear_ratio           = 1.
    motor.gearbox_efficiency   = 1.
    motor.expected_current     = 260.
    motor.mass_properties.mass = 2.0
    net.motor                  = motor   
    
    # Component 6 the Payload
    payload = SUAVE.Components.Energy.Peripherals.Payload()
    payload.power_draw           = 0. #Watts 
    payload.mass_properties.mass = 0. * Units.kg
    net.payload                  = payload
    
    # Component 7 the Avionics
    avionics = SUAVE.Components.Energy.Peripherals.Avionics()
    avionics.power_draw = 0. #Watts  
    net.avionics        = avionics      
    
    # Component 8 the Battery
    bat = SUAVE.Components.Energy.Storages.Battery()
    bat.mass_properties.mass = 50.  #kg
    bat.type = 'Li-Ion'
    bat.resistance = 0.0
    net.battery = bat
    
    #Component 9 the system logic controller and MPPT
    logic = SUAVE.Components.Energy.Distributors.Solar_Logic()
    logic.system_voltage  = 50.0
    logic.MPPT_efficiency = 0.95
    net.solar_logic       = logic
    
    # Setup the conditions to run the network
    conditions                 = Data()
    conditions.propulsion      = Data()
    conditions.freestream      = Data()
    conditions.frames          = Data()
#.........这里部分代码省略.........
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:103,代码来源:test_solar_network.py

示例4: __defaults__

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import frames [as 别名]
    def __defaults__(self):
        self.tag = 'Aerodynamic Segment'

        # atmosphere and planet
        self.planet     = None
        self.atmosphere = None
        self.start_time = time.gmtime()


        # --- Conditions and Unknowns

        # user shouldn't change these in an input script
        # only used for processing / post processing
        # they will be shared with analysis modules and meaningful naming is important

        # base matricies
        # use a trivial operation to copy the array
        ones_1col = np.ones([1,1])
        ones_2col = np.ones([1,2])
        ones_3col = np.ones([1,3])


        # --- Conditions

        # setup conditions
        conditions = Data()
        conditions.frames       = Data()
        conditions.freestream   = Data()
        conditions.aerodynamics = Data()
        conditions.propulsion   = Data()
        conditions.weights      = Data()
        conditions.energies     = Data()
        self.conditions = conditions

        # inertial frame conditions
        conditions.frames.inertial = Data()
        conditions.frames.inertial.position_vector      = ones_3col * 0
        conditions.frames.inertial.velocity_vector      = ones_3col * 0
        conditions.frames.inertial.acceleration_vector  = ones_3col * 0
        conditions.frames.inertial.gravity_force_vector = ones_3col * 0
        conditions.frames.inertial.total_force_vector   = ones_3col * 0
        conditions.frames.inertial.time                 = ones_1col * 0

        # wind frame conditions
        conditions.frames.wind = Data()
        conditions.frames.wind.body_rotations           = ones_3col * 0   # rotations in [X,Y,Z] -> [phi,theta,psi]
        conditions.frames.wind.velocity_vector          = ones_3col * 0
        conditions.frames.wind.lift_force_vector        = ones_3col * 0
        conditions.frames.wind.drag_force_vector        = ones_3col * 0
        conditions.frames.wind.transform_to_inertial    = np.empty([0,0,0])

        # body frame conditions
        conditions.frames.body = Data()
        conditions.frames.body.inertial_rotations       = ones_3col * 0    # rotations in [X,Y,Z] -> [phi,theta,psi]
        conditions.frames.body.thrust_force_vector      = ones_3col * 0
        conditions.frames.body.transform_to_inertial    = np.empty([0,0,0])

        # planet frame conditions
        conditions.frames.planet = Data()
        conditions.frames.planet.start_time      = None
        conditions.frames.planet.latitude        = ones_1col * 0
        conditions.frames.planet.longitude       = ones_1col * 0

        # freestream conditions
        conditions.freestream.velocity           = ones_1col * 0
        conditions.freestream.mach_number        = ones_1col * 0
        conditions.freestream.pressure           = ones_1col * 0
        conditions.freestream.temperature        = ones_1col * 0
        conditions.freestream.density            = ones_1col * 0
        conditions.freestream.speed_of_sound     = ones_1col * 0
        conditions.freestream.viscosity          = ones_1col * 0
        conditions.freestream.altitude           = ones_1col * 0
        conditions.freestream.gravity            = ones_1col * 0
        conditions.freestream.reynolds_number    = ones_1col * 0
        conditions.freestream.dynamic_pressure   = ones_1col * 0

        # aerodynamics conditions
        conditions.aerodynamics.angle_of_attack  = ones_1col * 0
        conditions.aerodynamics.side_slip_angle  = ones_1col * 0
        conditions.aerodynamics.roll_angle       = ones_1col * 0
        conditions.aerodynamics.lift_coefficient = ones_1col * 0
        conditions.aerodynamics.drag_coefficient = ones_1col * 0
        conditions.aerodynamics.lift_breakdown   = Data()
        conditions.aerodynamics.drag_breakdown   = Data()

        # propulsion conditions
        conditions.propulsion.throttle           = ones_1col * 0
        conditions.propulsion.fuel_mass_rate     = ones_1col * 0
        conditions.propulsion.battery_energy     = ones_1col * 0
        conditions.propulsion.thrust_breakdown   = Data()

        # weights conditions
        conditions.weights.total_mass            = ones_1col * 0
        conditions.weights.weight_breakdown      = Data()

        # energy conditions
        conditions.energies.total_energy         = ones_1col * 0
        conditions.energies.total_efficiency     = ones_1col * 0
        conditions.energies.gravity_energy       = ones_1col * 0
        conditions.energies.propulsion_power     = ones_1col * 0
#.........这里部分代码省略.........
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:103,代码来源:Aerodynamic_Segment.py


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