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


Python Data.items方法代码示例

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


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

示例1: check_results

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

    # check segment values
    truth = Data()
    truth.dist = [6426122.4935872 ,  5848398.49923247  ,7044468.46851841]
    truth.fuel = [ 14771. ,  12695.  , 12695.]

    error = Data()
    error.dist = np.max(np.abs(new_results.dist-truth.dist))
    error.fuel = np.max(np.abs(new_results.fuel-truth.fuel))

    for k,v in error.items():
        assert(np.abs(v)<0.001)
开发者ID:jiaxu825,项目名称:SUAVE,代码行数:15,代码来源:test_mission_E190_range_for_weights.py

示例2: check_results

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

    # check segment values
    truth = Data()

    truth.fuel = [ 14246. , 12234. , 12162.]
    truth.tow  = [ 53855. , 49919. , 39989.]

    error = Data()
    error.fuel = np.max(np.abs(new_results.fuel-truth.fuel))
    error.tow  = np.max(np.abs(new_results.tow-truth.tow))

    for k,v in error.items():
        assert(np.abs(v)<0.5)
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:16,代码来源:test_mission_E190_weights_for_range.py

示例3: main

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

    weight_landing    = 300000 * Units.lbs
    number_of_engines = 3.
    thrust_sea_level  = 40000 * Units.force_pounds
    thrust_landing    = 0.45 * thrust_sea_level
    
    noise = Correlations.shevell(weight_landing, number_of_engines, thrust_sea_level, thrust_landing)
    
    actual = Data()
    actual.takeoff = 99.7
    actual.side_line = 97.2
    actual.landing = 105.2
    
    error = Data()
    error.takeoff = (actual.takeoff - noise.takeoff)/actual.takeoff
    error.side_line = (actual.side_line - noise.side_line)/actual.side_line
    error.landing = (actual.landing - noise.landing)/actual.landing
    
    for k,v in error.items():
        assert(np.abs(v)<0.003)
        
    return
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:25,代码来源:DC_10_noise.py

示例4: main

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import items [as 别名]

#.........这里部分代码省略.........
    # --------------------------------------------------------------------
    # Initialize variables needed for CL and CD calculations
    # Use a seeded random order for values
    # --------------------------------------------------------------------
    
    random.seed(1)
    Mc = np.linspace(0.05,0.9,test_num)
    random.shuffle(Mc)
    rho = np.linspace(0.3,1.3,test_num)
    random.shuffle(rho)
    mu = np.linspace(5*10**-6,20*10**-6,test_num)
    random.shuffle(mu)
    T = np.linspace(200,300,test_num)
    random.shuffle(T)
    pressure = np.linspace(10**5,10**6,test_num)

    
    conditions = Data()
    
    conditions.freestream = Data()
    conditions.freestream.mach_number = Mc
    conditions.freestream.density = rho
    conditions.freestream.viscosity = mu
    conditions.freestream.temperature = T
    conditions.freestream.pressure = pressure
    
    conditions.aerodynamics = Data()
    conditions.aerodynamics.angle_of_attack = AoA
    conditions.aerodynamics.lift_breakdown = Data()
    
    configuration = vehicle.configs.cruise.aerodynamics_model.configuration
    
    conditions.aerodynamics.drag_breakdown = Data()

    geometry = Data()
    for k in ['fuselages','wings','propulsors']:
        geometry[k] = deepcopy(vehicle[k])    
    geometry.reference_area = vehicle.reference_area  
    
    # --------------------------------------------------------------------
    # Test compute Lift
    # --------------------------------------------------------------------
    
    compute_aircraft_lift(conditions, configuration, None) # geometry is third variable, not used
    
    lift = conditions.aerodynamics.lift_breakdown.total
    lift_r = np.array([-2.07712357, -0.73495391, -0.38858687, -0.1405849 ,  0.22295808,
                       0.5075275 ,  0.67883681,  0.92787301,  1.40470556,  2.08126751,
                       1.69661601])
    
    lift_test = np.abs((lift-lift_r)/lift)
    
    print '\nCompute Lift Test Results\n'
    print lift_test
        
    assert(np.max(lift_test)<1e-4), 'Aero regression failed at compute lift test'    
    
    
    # --------------------------------------------------------------------
    # Test compute drag 
    # --------------------------------------------------------------------
    
    compute_aircraft_drag(conditions, configuration, geometry)
    
    # Pull calculated values
    drag_breakdown = conditions.aerodynamics.drag_breakdown
    
    # Only one wing is evaluated since they rely on the same function
    cd_c           = drag_breakdown.compressible['Main Wing'].compressibility_drag
    cd_i           = drag_breakdown.induced.total
    cd_m           = drag_breakdown.miscellaneous.total
    cd_m_fuse_base = drag_breakdown.miscellaneous.fuselage_base
    cd_m_fuse_up   = drag_breakdown.miscellaneous.fuselage_upsweep
    cd_m_nac_base  = drag_breakdown.miscellaneous.nacelle_base['Turbo Fan']
    cd_m_ctrl      = drag_breakdown.miscellaneous.control_gaps
    cd_p_fuse      = drag_breakdown.parasite.Fuselage.parasite_drag_coefficient
    cd_p_wing      = drag_breakdown.parasite['Main Wing'].parasite_drag_coefficient
    cd_tot         = drag_breakdown.total
    
    (cd_c_r, cd_i_r, cd_m_r, cd_m_fuse_base_r, cd_m_fuse_up_r, cd_m_nac_base_r, cd_m_ctrl_r, cd_p_fuse_r, cd_p_wing_r, cd_tot_r) = reg_values()
    
    drag_tests = Data()
    drag_tests.cd_c = np.abs((cd_c-cd_c_r)/cd_c)
    drag_tests.cd_i = np.abs((cd_i-cd_i_r)/cd_i)
    drag_tests.cd_m = np.abs((cd_m-cd_m_r)/cd_m)
    # Line below is not normalized since regression values are 0, insert commented line if this changes
    drag_tests.cd_m_fuse_base = np.abs((cd_m_fuse_base-cd_m_fuse_base_r)) # np.abs((cd_m_fuse_base-cd_m_fuse_base_r)/cd_m_fuse_base)
    drag_tests.cd_m_fuse_up   = np.abs((cd_m_fuse_up - cd_m_fuse_up_r)/cd_m_fuse_up)
    drag_tests.cd_m_ctrl      = np.abs((cd_m_ctrl - cd_m_ctrl_r)/cd_m_ctrl)
    drag_tests.cd_p_fuse      = np.abs((cd_p_fuse - cd_p_fuse_r)/cd_p_fuse)
    drag_tests.cd_p_wing      = np.abs((cd_p_wing - cd_p_wing_r)/cd_p_wing)
    drag_tests.cd_tot         = np.abs((cd_tot - cd_tot_r)/cd_tot)
    
    print '\nCompute Drag Test Results\n'
    print drag_tests
    
    for i, tests in drag_tests.items():
        assert(np.max(tests)<1e-4),'Aero regression test failed at ' + i
    
    return conditions, configuration, geometry, test_num
开发者ID:spendres,项目名称:SUAVE,代码行数:104,代码来源:test_aerodynamics.py

示例5: main

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import items [as 别名]

#.........这里部分代码省略.........
    wing.aspect_ratio = wing.spans.projected**2/wing.areas.reference
    wing.origin     = np.array([36.3,0,0])  * Units.feet
    wing.symmetric= True
    wing.eta      = 0.95
    wing.downwash_adj = 1.0 - 2.0*vehicle.wings['Main Wing'].CL_alpha/np.pi/wing.aspect_ratio
    wing.ep_alpha       = 1. - wing.downwash_adj    
    wing.aerodynamic_center  = [trapezoid_ac_x(wing), 0.0, 0.0] - wing.origin
    wing.CL_alpha = datcom(wing,Mach)
    vehicle.append_component(wing)
    lifting_surfaces.append(wing)
    
    fuselage = SUAVE.Components.Fuselages.Fuselage()
    fuselage.tag = 'Fuselage'
    fuselage.x_root_quarter_chord = 5.4 * Units.feet
    fuselage.lengths.total     = 44.0  * Units.feet
    fuselage.width      = 5.4   * Units.feet 
    vehicle.append_component(fuselage)
    
    configuration = Data()
    configuration.mass_properties = Data()
    configuration.mass_properties.center_of_gravity = Data()
    configuration.mass_properties.center_of_gravity = np.array([17.2,0,0]) * Units.feet    
    
    #Method Test   
    
    cm_a = taw_cmalpha(vehicle,Mach,conditions,configuration)
    
    expected = 12.57 # Should be -2.08
    error.cm_a_beech_99 = (cm_a - expected)/expected   
    
    #Parameters Required
    #Using values for an SIAI Marchetti S-211
    vehicle = SUAVE.Vehicle()
    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'Main Wing'
    wing.areas.reference           = 136.0 * Units.feet**2
    wing.spans.projected           = 26.3  * Units.feet
    wing.chords.mean_aerodynamic = 5.4 * Units.feet
    wing.sweep       = 195   * Units.deg # Leading edge
    wing.taper          = 3.1/7.03
    wing.aspect_ratio   = wing.spans.projected**2/wing.areas.reference
    wing.symmetric      = True
    wing.origin           = np.array([12.11,0,0]) * Units.feet  
    wing.aerodynamic_center  = np.array([16.6, 0. , 0. ]) - wing.origin
    wing.eta            = 1.0
    wing.downwash_adj   = 1.0
    wing.ep_alpha       = 1. - wing.downwash_adj
    
    Mach                    = np.array([0.111])
    reference               = SUAVE.Structure.Container()
    conditions = Data()
    conditions.lift_curve_slope = datcom(wing,Mach)
    wing.CL_alpha = conditions.lift_curve_slope
    vehicle.reference_area   = wing.areas.reference
    vehicle.append_component(wing)
    
    lifting_surfaces    = []
    lifting_surfaces.append(wing)
    
    wing          = SUAVE.Components.Wings.Wing()
    wing.tag = 'Horizontal Stabilizer'
    wing.areas.reference     = 36.46 * Units.feet**2
    wing.spans.projected     = 13.3   * Units.feet
    wing.sweep = 18.5   * Units.deg # leading edge
    wing.taper    = 1.6/3.88
    wing.aspect_ratio = wing.spans.projected**2/wing.areas.reference
    wing.origin     = np.array([26.07,0.,0.]) * Units.feet
    wing.symmetric= True
    wing.eta      = 0.9
    wing.downwash_adj = 1.0 - 2.0*vehicle.wings['Main Wing'].CL_alpha/np.pi/wing.aspect_ratio
    wing.ep_alpha       = 1. - wing.downwash_adj    
    wing.aerodynamic_center  = [trapezoid_ac_x(wing), 0.0, 0.0] - wing.origin
    wing.CL_alpha = datcom(wing,Mach)
    vehicle.append_component(wing)
    lifting_surfaces.append(wing)
    
    fuselage = SUAVE.Components.Fuselages.Fuselage()
    fuselage.tag = 'Fuselage'
    fuselage.x_root_quarter_chord = 12.67 * Units.feet
    fuselage.lengths.total     = 30.9  * Units.feet
    fuselage.width      = ((2.94+5.9)/2)   * Units.feet 
    vehicle.append_component(fuselage)
    
    configuration = Data()
    configuration.mass_properties = Data()
    configuration.mass_properties.center_of_gravity = Data()
    configuration.mass_properties.center_of_gravity = np.array([16.6,0,0]) * Units.feet    
    
    #Method Test   
    
    cm_a = taw_cmalpha(vehicle,Mach,conditions,configuration)
    
    expected = -27.9 # should be -0.6

    error.cm_a_SIAI = (cm_a - expected)/expected

    for k,v in error.items():
        assert(np.abs(v)<0.005)
        
    return
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:104,代码来源:test_cmalpha.py

示例6: main

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import items [as 别名]
def main():
    vehicle = SUAVE.Vehicle()# Create the vehicle for testing
    
    # Parameters Required
    vehicle.envelope.ultimate_load                      = 3.5                             # Ultimate load
    vehicle.mass_properties.max_takeoff                 = 79015.8 * Units.kilograms       # Maximum takeoff weight in kilograms
    vehicle.mass_properties.max_zero_fuel               = 79015.8 * 0.9 * Units.kilograms # Maximum zero fuel weight in kilograms
    vehicle.envelope.limit_load                         = 1.5                             # Limit Load
    
    turbofan = SUAVE.Components.Propulsors.TurboFanPASS()
    turbofan.tag = 'Turbo Fan'    
    turbofan.number_of_engines   = 2.                              # Number of engines on the aircraft
    turbofan.thrust.design  = 1000.   * Units.newton    # Define Thrust in Newtons    
    vehicle.append_component(turbofan) 

    vehicle.passengers                                  = 170.                            # Number of passengers
    vehicle.mass_properties.cargo                       = 0.  * Units.kilogram            # Mass of cargo
    vehicle.systems.control                             = "fully powered"                 # Specify fully powered, partially powered or anything else is fully aerodynamic
    vehicle.systems.accessories                         = "medium-range"                  # Specify what type of aircraft you have
    
    vehicle.reference_area                              = 124.862  * Units.meter**2  # Wing gross area in square meters
    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'Main Wing'
    wing.spans.projected          = 50.      * Units.meter     # Span in meters
    wing.taper                    = 0.2                        # Taper ratio
    wing.thickness_to_chord       = 0.08                       # Thickness-to-chord ratio
    wing.sweep                    = .4363323 * Units.rad       # sweep angle in degrees
    wing.chords.root              = 15.      * Units.meter     # Wing root chord length
    wing.chords.mean_aerodynamic  = 10.      * Units.meters    # Length of the mean aerodynamic chord of the wing
    wing.position                 = [20,0,0] * Units.meters    # Location of main wing from origin of the vehicle
    wing.aerodynamic_center       = [3,0,0]  * Units.meters    # Location of aerodynamic center from origin of the main wing
    vehicle.append_component(wing)
    
    fuselage = SUAVE.Components.Fuselages.Fuselage()
    fuselage.tag = 'Fuselage'    
    fuselage.areas.wetted             = 688.64    * Units.meter**2  # Fuselage wetted area 
    fuselage.differential_pressure    = 55960.5   * Units.pascal    # Maximum differential pressure
    fuselage.width                    = 4.        * Units.meter     # Width of the fuselage
    fuselage.heights.maximum          = 4.        * Units.meter     # Height of the fuselage
    fuselage.lengths.total            = 58.4      * Units.meter     # Length of the fuselage
    fuselage.number_coach_seats       = 200.       
    vehicle.append_component(fuselage)
    
    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'Horizontal Stabilizer'    
    wing.areas.reference          = 75.     * Units.meters**2 # Area of the horizontal tail
    wing.spans.projected          = 15.     * Units.meters    # Span of the horizontal tail
    wing.sweep                    = 38.     * Units.deg       # Sweep of the horizontal tail
    wing.chords.mean_aerodynamic  = 5.      * Units.meters    # Length of the mean aerodynamic chord of the horizontal tail
    wing.thickness_to_chord       = 0.07                      # Thickness-to-chord ratio of the horizontal tail
    wing.areas.exposed            = 199.7792                  # Exposed area of the horizontal tail
    wing.areas.wetted             = 249.724                   # Wetted area of the horizontal tail
    wing.position                 = [45,0,0]                  # Location of horizontal tail from origin of the vehicle
    wing.aerodynamic_center       = [3,0,0]                   # Location of aerodynamic center from origin of the horizontal tail
    vehicle.append_component(wing)    
    
    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'Vertical Stabilizer'    
    wing.areas.reference     = 60.     * Units.meters**2 # Area of the vertical tail
    wing.spans.projected     = 15.     * Units.meters    # Span of the vertical tail
    wing.thickness_to_chord  = 0.07                      # Thickness-to-chord ratio of the vertical tail
    wing.sweep               = 40.     * Units.deg       # Sweep of the vertical tail
    wing.t_tail              = "false"                   # Set to "yes" for a T-tail
    vehicle.append_component(wing)   
    
    weight = Tube_Wing.empty(vehicle)
    
    actual = Data()
    actual.payload = 17349.9081525
    actual.pax = 15036.5870655
    actual.bag = 2313.321087
    actual.fuel = -6993.89102491
    actual.empty = 68659.7828724
    actual.wing = 27694.192985
    actual.fuselage = 11504.5186408
    actual.propulsion = 88.3696093424
    actual.landing_gear = 3160.632
    actual.systems = 16655.7076511
    actual.wt_furnish = 7466.1304102
    actual.horizontal_tail = 2191.30720639
    actual.vertical_tail = 5260.75341411
    actual.rudder = 2104.30136565    
    
    error = Data()
    error.payload = (actual.payload - weight.payload)/actual.payload
    error.pax = (actual.pax - weight.pax)/actual.pax
    error.bag = (actual.bag - weight.bag)/actual.bag
    error.fuel = (actual.fuel - weight.fuel)/actual.fuel
    error.empty = (actual.empty - weight.empty)/actual.empty
    error.wing = (actual.wing - weight.wing)/actual.wing
    error.fuselage = (actual.fuselage - weight.fuselage)/actual.fuselage
    error.propulsion = (actual.propulsion - weight.propulsion)/actual.propulsion
    error.landing_gear = (actual.landing_gear - weight.landing_gear)/actual.landing_gear
    error.systems = (actual.systems - weight.systems)/actual.systems
    error.wt_furnish = (actual.wt_furnish - weight.wt_furnish)/actual.wt_furnish
    error.horizontal_tail = (actual.horizontal_tail - weight.horizontal_tail)/actual.horizontal_tail
    error.vertical_tail = (actual.vertical_tail - weight.vertical_tail)/actual.vertical_tail
    error.rudder = (actual.rudder - weight.rudder)/actual.rudder
      
    for k,v in error.items():
#.........这里部分代码省略.........
开发者ID:spendres,项目名称:SUAVE,代码行数:103,代码来源:test_weights.py

示例7: main

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

    # Taken from Blakelock
    
    #Lateral/Directional Inputs
    velocity = 440 * (Units['ft/sec']) # Flight Velocity
    Cn_Beta = 0.096 # Yawing moment coefficient due to sideslip
    S_gross_w = 2400 * (Units['ft**2']) # Wing reference area
    density = 0.002378 * (Units['slugs/ft**3']) # Sea level density
    span = 130 * Units.ft # Span of the aircraft
    mass = 5900 * Units.slugs # mass of the aircraft
    I_x = 1.995 * 10**6 * (Units['slugs*ft**2']) # Moment of Inertia in x-axis
    I_z = 4.2 * 10**6 * (Units['slugs*ft**2']) # Moment of Inertia in z-axis
    Cn_r = -0.107 # Yawing moment coefficient due to yawing velocity
    Cl_p = -0.38 #  Rolling moment coefficient due to the rolling velocity
    Cy_phi = 0.344 # Side force coefficient due to aircraft roll
    Cl_Beta = -0.057 # Rolling moment coefficient due to to sideslip
    Cl_r = 0.086 # Rolling moment coefficient due to the yawing velocity (usually evaluated analytically)
    J_xz = 0 # Assumed
    Cn_p = -0.0228
    Cy_psi = 0
    Cy_Beta = -0.6
    mass = 5900 * Units.slugs # mass of the aircraft
    
       
    dutch_roll=Approximations.dutch_roll(velocity, Cn_Beta, S_gross_w, density, span, I_z, Cn_r)
    roll_tau = Approximations.roll(I_x, S_gross_w, density, velocity, span, Cl_p)
    spiral_tau = Approximations.spiral(mass, velocity, density, S_gross_w, Cl_p, Cn_Beta, Cy_phi, Cl_Beta, Cn_r, Cl_r)
    lateral_directional = Full_Linearized_Equations.lateral_directional(velocity, Cn_Beta, S_gross_w, density, span, I_z, Cn_r, I_x, Cl_p, J_xz, Cl_r, Cl_Beta, Cn_p, Cy_phi, Cy_psi, Cy_Beta, mass)
        
    # Longitudinal Inputs
    mass= 5800 * Units.slugs # mass of the aircraft
    velocity = 600 * (Units['ft/sec']) # Flight Velocity
    mac = 20.2 * Units.ft # mean aerodynamic chord
    Cm_q = -11.4 # Change in pitching moment coefficient due to pitching velocity
    CL = 0.74 # Coefficient of Lift
    CD = 0.044 # Coefficient of Drag
    CL_alpha = 4.42 # Change in aircraft lift due to change in angle of attack
    Cz_alpha = -4.46
    SM = -0.14 # static margin
    Cm_alpha = SM * CL_alpha
    Cm_alpha_dot = -3.27
    Iy = 2.62 * 10**6 * (Units['slugs*ft**2']) # Moment of Inertia in y-axis
    density = 0.000585 * (Units['slugs/ft**3']) # 40,000 ft density
    g = 9.8 # gravitational constant
    Cz_u = -2*CL # change in Z force with respect to change in forward velocity
    Cm_alpha_dot = -3.27
    Cz_q = -3.94
    Cw = -CL 
    Theta = 0
    Cx_u = -2*CD
    Cx_alpha = 0.392
    Cz_alpha_dot = -1.13
    
    short_period = Approximations.short_period(velocity, density, S_gross_w, mac, Cm_q, Cz_alpha, mass, Cm_alpha, Iy, Cm_alpha_dot)
    phugoid = Approximations.phugoid(g, velocity, CD, CL)
    longitudinal = Full_Linearized_Equations.longitudinal(velocity, density, S_gross_w, mac, Cm_q, Cz_alpha, mass, Cm_alpha, Iy, Cm_alpha_dot, Cz_u, Cz_alpha_dot, Cz_q, Cw, Theta, Cx_u, Cx_alpha)
    
    # Expected Values
    Blakelock = Data()
    Blakelock.longitudinal_short_zeta = 0.352
    Blakelock.longitudinal_short_w_n = 1.145
    Blakelock.longitudinal_phugoid_zeta = 0.032
    Blakelock.longitudinal_phugoid_w_n = 0.073
    Blakelock.short_period_short_w_n = 1.15
    Blakelock.short_period_short_zeta = 0.35
    Blakelock.phugoid_phugoid_w_n = 0.0765
    Blakelock.phugoid_phugoid_zeta = 0.042
    Blakelock.lateral_directional_dutch_w_n = 1.345
    Blakelock.lateral_directional_dutch_zeta = 0.14
    Blakelock.lateral_directional_spiral_tau = 1/0.004
    Blakelock.lateral_directional_roll_tau = -1/2.09
    Blakelock.dutch_roll_dutch_w_n = 1.28
    Blakelock.dutch_roll_dutch_zeta = 0.114
    Blakelock.spiral_tau = 1./0.0042
    Blakelock.roll_tau = -0.493
    
    # Calculating error percentage
    error = Data()
    error.longitudinal_short_zeta = (Blakelock.longitudinal_short_zeta - longitudinal.short_damping_ratio) / Blakelock.longitudinal_short_zeta
    error.longitudinal_short_w_n = (Blakelock.longitudinal_short_w_n - longitudinal.short_natural_frequency) / Blakelock.longitudinal_short_w_n
    error.longitudinal_phugoid_zeta = (Blakelock.longitudinal_phugoid_zeta - longitudinal.phugoid_damping_ratio) / Blakelock.longitudinal_phugoid_zeta
    error.longitudinal_phugoid_w_n = (Blakelock.longitudinal_phugoid_w_n - longitudinal.phugoid_natural_frequency) / Blakelock.longitudinal_phugoid_w_n
    error.short_period_w_n = (Blakelock.short_period_short_w_n - short_period.natural_frequency) / Blakelock.short_period_short_w_n
    error.short_period_short_zeta = (Blakelock.short_period_short_zeta - short_period.damping_ratio) / Blakelock.short_period_short_zeta
    error.phugoid_phugoid_w_n = (Blakelock.phugoid_phugoid_w_n - phugoid.natural_frequency) / Blakelock.phugoid_phugoid_w_n
    error.phugoid_phugoid_zeta = (Blakelock.phugoid_phugoid_zeta - phugoid.damping_ratio) / Blakelock.phugoid_phugoid_zeta
    error.lateral_directional_dutch_w_n = (Blakelock.lateral_directional_dutch_w_n - lateral_directional.dutch_natural_frequency) / Blakelock.lateral_directional_dutch_w_n
    error.lateral_directional_dutch_zeta = (Blakelock.lateral_directional_dutch_zeta - lateral_directional.dutch_damping_ratio) / Blakelock.lateral_directional_dutch_zeta                              
    error.lateral_directional_spiral_tau = (Blakelock.lateral_directional_spiral_tau - lateral_directional.spiral_tau) / Blakelock.lateral_directional_spiral_tau
    error.lateral_directional_roll_tau = (Blakelock.lateral_directional_roll_tau - lateral_directional.roll_tau) / Blakelock.lateral_directional_roll_tau
    error.dutch_roll_dutch_w_n = (Blakelock.dutch_roll_dutch_w_n - dutch_roll.natural_frequency) / Blakelock.dutch_roll_dutch_w_n
    error.dutch_roll_dutch_zeta = (Blakelock.dutch_roll_dutch_zeta - dutch_roll.damping_ratio) / Blakelock.dutch_roll_dutch_zeta
    error.spiral_tau = (Blakelock.spiral_tau - spiral_tau) / Blakelock.spiral_tau                               
    error.roll_tau = (Blakelock.roll_tau - roll_tau) / Blakelock.roll_tau
    
    print  error
    
    for k,v in error.items():
        assert(np.abs(v)<0.08)
#.........这里部分代码省略.........
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:103,代码来源:test_dynamicstability.py

示例8: main

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import items [as 别名]

#.........这里部分代码省略.........
    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()
    conditions.frames.body     = Data()
    conditions.frames.inertial = Data()
    conditions.frames.planet   = Data()
    numerics                   = Data()
    
    # Calculate atmospheric properties
    atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    p, T, rho, a, mu = atmosphere.compute_values(design_altitude)
    
    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.viscosity           = np.array([mu, mu])
    conditions.freestream.speed_of_sound      = np.array([a, a])
    conditions.freestream.altitude            = np.array([[design_altitude], [design_altitude]])
    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.integrate_time                   = 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])
    
    # Run the network and print the results
    F, mdot, P = net(conditions,numerics)
    
    # Truth results
    truth_F   = [[538.00449442], [538.00449442]]
    truth_P   = [[14272.1902522],[14272.1902522]]
    truth_i   = [[ 249.31622624],[ 249.31622624]]
    truth_rpm = [[ 6668.4094191],[ 6668.4094191]]
    truth_bat = [[45000000.] , [44987534.18868808]]
    
    error = Data()
    error.Thrust = np.max(np.abs(F-truth_F))
    error.Propeller_Power   = np.max(np.abs(P-truth_P))
    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.CurrentEnergy-truth_bat))
    
    print  error
    
    for k,v in error.items():
        assert(np.abs(v)<0.001)
        
    
    return
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:104,代码来源:test_solar_network.py

示例9: main

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import items [as 别名]

#.........这里部分代码省略.........
    vertical.taper        = vertical.tip_chord/ref_vertical.ref_root_chord
    vertical.effective_aspect_ratio = 1.57
    vertical.x_ac_LE      = trapezoid_ac_x(vertical)
    
    aircraft              = SUAVE.Vehicle()
    aircraft.wing         = wing
    aircraft.fuselage     = fuselage
    aircraft.other_bodies = other_bodies
    aircraft.vertical     = vertical
    aircraft.Mass_Props.pos_cg[0] = 17.2 * Units.feet
    
    segment            = SUAVE.Attributes.Missions.Segments.Base_Segment()
    segment.M          = 0.152
    segment.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    altitude           = 0.0 * Units.feet
    segment.a          = segment.atmosphere.compute_values(altitude / Units.km, type="a")
    segment.rho        = segment.atmosphere.compute_values(altitude / Units.km, type="rho")
    segment.mew        = segment.atmosphere.compute_values(altitude / Units.km, type="mew")
    segment.v_inf      = segment.M * segment.a
    
    #Method Test
    expected = 0.12
    print 'Beech 99 at M = {0} and h = {1} meters'.format(segment.M, altitude)
    cn_b = taw_cnbeta(aircraft,segment)
    
    print 'Cn_beta        = {0:.4f}'.format(cn_b)
    print 'Expected value = {}'.format(expected)
    print 'Percent Error  = {0:.2f}%'.format(100.0*(cn_b-expected)/expected)
    print ' '  
    
    
    #Parameters Required
    #Using values for an SIAI Marchetti S-211
    wing               = SUAVE.Components.Wings.Wing()
    wing.area          = 136.0 * Units.feet**2
    wing.span          = 26.3  * Units.feet
    wing.sweep_le      = 19.5  * Units.deg
    wing.z_position    = -1.1  * Units.feet
    wing.taper         = 3.1/7.03
    wing.aspect_ratio  = wing.span**2/wing.area
    
    fuselage           = SUAVE.Components.Fuselages.Fuselage()
    fuselage.side_area = 116.009 * Units.feet**2
    fuselage.length    = 30.9    * Units.feet
    fuselage.h_max     = 5.1     * Units.feet
    fuselage.w_max     = 5.9     * Units.feet
    fuselage.height_at_vroot_quarter_chord   = 4.1 * Units.feet
    fuselage.height_at_quarter_length        = 4.5 * Units.feet
    fuselage.height_at_three_quarters_length = 4.3 * Units.feet
    
    other_bodies       = []
    
    vertical              = SUAVE.Components.Wings.Wing()
    vertical.span         = 5.8   * Units.feet
    vertical.root_chord   = 5.7   * Units.feet
    vertical.tip_chord    = 2.0   * Units.feet
    vertical.sweep_le     = 40.2  * Units.deg
    vertical.x_root_LE1   = 22.62 * Units.feet
    vertical.symmetric    = False
    dz_centerline         = 2.9   * Units.feet
    ref_vertical          = extend_to_ref_area(vertical,dz_centerline)
    vertical.span         = ref_vertical.ref_span
    vertical.area         = ref_vertical.ref_area
    vertical.aspect_ratio = ref_vertical.ref_aspect_ratio
    vertical.x_root_LE    = vertical.x_root_LE1 + ref_vertical.root_LE_change
    vertical.taper        = vertical.tip_chord/ref_vertical.ref_root_chord
    vertical.effective_aspect_ratio = 2.65
    vertical.x_ac_LE      = trapezoid_ac_x(vertical)
    
    aircraft              = SUAVE.Vehicle()
    aircraft.wing         = wing
    aircraft.fuselage     = fuselage
    aircraft.other_bodies = other_bodies
    aircraft.vertical     = vertical
    aircraft.Mass_Props.pos_cg[0] = 16.6 * Units.feet
    
    segment            = SUAVE.Attributes.Missions.Segments.Base_Segment()
    segment.M          = 0.111
    segment.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    altitude           = 0.0 * Units.feet
    segment.a          = segment.atmosphere.compute_values(altitude / Units.km, type="a")
    segment.rho        = segment.atmosphere.compute_values(altitude / Units.km, type="rho")
    segment.mew        = segment.atmosphere.compute_values(altitude / Units.km, type="mew")
    segment.v_inf      = segment.M * segment.a
    
    #Method Test
    print 'SIAI Marchetti S-211 at M = {0} and h = {1} meters'.format(segment.M, altitude)
    
    cn_b = taw_cnbeta(aircraft,segment)
    
    expected = 0.160
    print 'Cn_beta        = {0:.4f}'.format(cn_b)
    print 'Expected value = {}'.format(expected)
    print 'Percent Error  = {0:.2f}%'.format(100.0*(cn_b-expected)/expected)
    print ' '"""
    
    for k,v in error.items():
        assert(np.abs(v)<0.1)
        
    return
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:104,代码来源:test_cnbeta.py

示例10: main

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import items [as 别名]
def main():
    
    # This script could fail if either the design or analysis scripts fail,
    # in case of failure check both. The design and analysis powers will 
    # differ because of karman-tsien compressibility corrections in the 
    # analysis scripts
    
    # Design the Propeller
    prop_attributes = Data()
    prop_attributes.number_blades       = 2.0 
    prop_attributes.freestream_velocity = 50.0
    prop_attributes.angular_velocity    = 2000.*(2.*np.pi/60.0)
    prop_attributes.tip_radius          = 1.5
    prop_attributes.hub_radius          = 0.05
    prop_attributes.design_Cl           = 0.7 
    prop_attributes.design_altitude     = 0.0 * Units.km
    prop_attributes.design_thrust       = 0.0
    prop_attributes.design_power        = 7000.
    prop_attributes                     = propeller_design(prop_attributes)    

    # Find the operating conditions
    atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    p, T, rho, a, mu = atmosphere.compute_values(prop_attributes.design_altitude)
    
    V = prop_attributes.freestream_velocity
    
    conditions = Data()
    conditions.freestream = Data()
    conditions.propulsion = Data()
    conditions.freestream.density        = np.array([rho])
    conditions.freestream.viscosity      = np.array([mu])
    conditions.freestream.velocity       = np.array([[V]])
    conditions.freestream.speed_of_sound = np.array([a])
    conditions.freestream.temperature    = np.array([T])
    conditions.propulsion.throttle       = np.array([[1.0]])
    
    # Create and attach this propeller
    prop                 = SUAVE.Components.Energy.Converters.Propeller()
    prop.prop_attributes = prop_attributes    
    prop.inputs.omega    = prop_attributes.angular_velocity
    
    F, Q, P, Cplast = prop.spin(conditions)
    
    # Truth values
    F_truth      = 166.41590262
    Q_truth      = 45.21732911
    P_truth      = 9470.2952633 # Over 9000!
    Cplast_truth = 0.00085898
    
    error = Data()
    error.Thrust  = np.max(np.abs(F-F_truth))
    error.Power   = np.max(np.abs(P-P_truth))
    error.Torque  = np.max(np.abs(Q-Q_truth))
    error.Cp      = np.max(np.abs(Cplast-Cplast_truth))   
    
    print  error
    
    for k,v in error.items():
        assert(np.abs(v)<0.001)
     
    return
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:63,代码来源:test_propeller.py


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