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


Python Data.constraints方法代码示例

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


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

示例1: setup

# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import constraints [as 别名]
def setup():

    nexus = Nexus()
    problem = Data()
    nexus.optimization_problem = problem

    # -------------------------------------------------------------------
    # Inputs
    # -------------------------------------------------------------------

    #   [ tag                            , initial, (lb,ub)             , scaling , units ]
    problem.inputs = np.array([
        [ 'wing_area'                    ,  95    , (   90. ,   130.   ) ,   100. , Units.meter**2],
        [ 'cruise_altitude'              ,  11    , (   9   ,    14.   ) ,   10.  , Units.km],
    ])

    # -------------------------------------------------------------------
    # Objective
    # -------------------------------------------------------------------

    # throw an error if the user isn't specific about wildcards
    # [ tag, scaling, units ]
    problem.objective = np.array([
        [ 'fuel_burn', 10000, Units.kg ]
    ])
    
    # -------------------------------------------------------------------
    # Constraints
    # -------------------------------------------------------------------
    
    # [ tag, sense, edge, scaling, units ]
    problem.constraints = np.array([
        [ 'design_range_fuel_margin' , '>', 0., 1E-1, Units.less], #fuel margin defined here as fuel 
    ])
    
    # -------------------------------------------------------------------
    #  Aliases
    # -------------------------------------------------------------------
    
    # [ 'alias' , ['data.path1.name','data.path2.name'] ]

    problem.aliases = [
        [ 'wing_area'                        ,   ['vehicle_configurations.*.wings.main_wing.areas.reference',
                                                  'vehicle_configurations.*.reference_area'                    ]],
        [ 'cruise_altitude'                  , 'missions.base.segments.climb_5.altitude_end'                    ],
        [ 'fuel_burn'                        ,    'summary.base_mission_fuelburn'                               ],
        [ 'design_range_fuel_margin'         ,    'summary.max_zero_fuel_margin'                                ],
    ]    
    
    # -------------------------------------------------------------------
    #  Vehicles
    # -------------------------------------------------------------------
    nexus.vehicle_configurations = Vehicles.setup()
    
    # -------------------------------------------------------------------
    #  Analyses
    # -------------------------------------------------------------------
    nexus.analyses = Analyses.setup(nexus.vehicle_configurations)
    
    # -------------------------------------------------------------------
    #  Missions
    # -------------------------------------------------------------------
    nexus.missions = Missions.setup(nexus.analyses)
    
    # -------------------------------------------------------------------
    #  Procedure
    # -------------------------------------------------------------------    
    nexus.procedure = Procedure.setup()
    
    # -------------------------------------------------------------------
    #  Summary
    # -------------------------------------------------------------------    
    nexus.summary = Data()    
    nexus.total_number_of_iterations = 0
    return nexus
开发者ID:suavecode,项目名称:Tutorials,代码行数:77,代码来源:Optimize.py

示例2: setup

# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import constraints [as 别名]
def setup():
    nexus = Nexus()
    problem = Data()
    nexus.optimization_problem = problem

    # -------------------------------------------------------------------
    # Inputs
    # -------------------------------------------------------------------

    problem.inputs = np.array([
        # Variable inputs
        ['wing_area', 700., (650., 725.), 500., Units.meter ** 2],
        ['MTOW', 207e3, (207e3, 207e3), 200e3, Units.kg],
        ['alt_outgoing_cruise', 13.14, (9., 14.), 13., Units.km],  # 13.15 #explain the physics behing the optimizer
        ['design_thrust', 110e3, (100e3, 120e3), 100e3, Units.N],
        ['outgoing_cruise_speed', 190., (180., 212.), 200., Units['m/s']],  # 191
        ['spray_cruise_speed', 210., (205., 212.), 200, Units['m/s']],

        ['cruise1_distance', 1050., (1000., 1200.), 1075., Units.km],
        ['cruise2_distance', 1173., (1000., 1300.), 1225., Units.km],
        ['cruise3_distance', 1001., (900., 1200.), 1000., Units.km],

        ['cruise_outgoing_distance', 3393., (3200., 3500.), 3300., Units.km],
        # climb throttle as input?

        # "Set" inputs
        ['AR', 13., (12., 14.), 13., Units.less],  # aerosol released per kg of fuel ratio max?
        ['payload', 35e3, (35e3, 35e3), 30e3, Units.kg],
        # speeds???
    ])

    # -------------------------------------------------------------------
    # Objective
    # -------------------------------------------------------------------

    # throw an error if the user isn't specific about wildcards
    # [ tag, scaling, units ]
    problem.objective = np.array([
        ['fuel_burn', 60000., Units.kg]
    ])

    # -------------------------------------------------------------------
    # Constraints
    # -------------------------------------------------------------------

    # [ tag, sense, edge, scaling, units ]
    problem.constraints = np.array([

        # ['min_throttle', '>', 0., 1e-1, Units.less],
        ['max_throttle', '<', 1., 1., Units.less],
        # ['main_mission_time', '<', 11.1, 10, Units.h],
        ['design_range_fuel_margin', '>', 0.1, 1E-1, Units.less],
        # ['take_off_field_length', '<', 2500., 2500, Units.m],
        # ['landing_field_length', '<', 2500., 2500, Units.m],
        ['clmax', '<', 1.1, 1, Units.less],
        ['non_spraying_range', '>', 3500., 3500., Units.km],
        ['spraying_range', '>', 3500., 3500., Units.km]
        # main mission range

    ])

    # -------------------------------------------------------------------
    #  Aliases
    # -------------------------------------------------------------------

    # [ 'alias' , ['data.path1.name','data.path2.name'] ]

    problem.aliases = [
        ['wing_area', ['vehicle_configurations.*.wings.main_wing.areas.reference',
                       'vehicle_configurations.*.reference_area']],

        ['MTOW', ['vehicle_configurations.*.mass_properties.takeoff',
                  "vehicle_configurations.*.mass_properties.max_takeoff"]],

        ['alt_outgoing_cruise', 'missions.base.segments.final_outgoing.altitude_end'],

        ['design_thrust', 'vehicle_configurations.*.propulsors.turbofan.thrust.total_design'],

        ['spray_cruise_speed', ['missions.base.segments.cruise_1.air_speed',
                                'missions.base.segments.cruise_2.air_speed',
                                'missions.base.segments.cruise_final.air_speed']],

        ['outgoing_cruise_speed', 'missions.base.segments.cruise_outgoing.air_speed'],

        ['AR', 'vehicle_configurations.*.wings.main_wing.aspect_ratio'],

        ['payload', ['vehicle_configurations.*.mass_properties.max_payload',
                     'vehicle_configurations.*.mass_properties.payload']],

        ['fuel_burn', 'summary.base_mission_fuelburn'],

        ['min_throttle', 'summary.min_throttle'],

        ['max_throttle', 'summary.max_throttle'],

        ['main_mission_time', 'summary.main_mission_time'],

        ['mission_range', 'summary.mission_range'],

        ['clmax', 'summary.clmax'],
#.........这里部分代码省略.........
开发者ID:lukekulik,项目名称:saga-one,代码行数:103,代码来源:Optimize.py

示例3: setup

# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import constraints [as 别名]
def setup():

    nexus = Nexus()
    problem = Data()
    nexus.optimization_problem = problem

    # -------------------------------------------------------------------
    # Inputs
    # -------------------------------------------------------------------

    # [ tag , initial, [lb,ub], scaling, units ]
    problem.inputs = np.array([
        [ 'wing_area'                    ,    124.8 , (    70.    ,   200.   ) ,   124.8 , Units.meter**2],
        [ 'wing_aspect_ratio'            ,     10.18, (     5.    ,    20.   ) ,    10.18,     Units.less],
        [ 'wing_sweep'                   ,    25.   , (     0.    ,    35.   ) ,    25.  ,  Units.degrees],
        [ 'wing_thickness'               ,     0.105 , (     0.07  ,     0.20 ) ,     0.105,     Units.less],
        [ 'design_thrust'                , 52700.   , ( 10000.    , 70000.   ) , 52700.  ,        Units.N],
        [ 'MTOW'                         , 79090.   , ( 20000.    ,100000.   ) , 79090.  ,       Units.kg],
        [ 'MZFW_ratio'                   ,     0.77 , (     0.6   ,     0.99 ) ,    0.77 ,     Units.less],
        [ 'flap_takeoff_angle'           ,    10.   , (     0.    ,    20.   ) ,    10.  ,  Units.degrees],
        [ 'flap_landing_angle'           ,    40.   , (     0.    ,    50.   ) ,    40.  ,  Units.degrees],
        [ 'short_field_TOW'              , 64030.   , ( 20000.    ,100000.   ) , 64030.  ,       Units.kg],
        [ 'design_TOW'                   , 68520.   , ( 20000.    ,100000.   ) , 68520.  ,       Units.kg],
        [ 'noise_takeoff_speed_increase' ,    10.0  , (    10.    ,    20.   ) ,    10.0 ,     Units.knots],
        [ 'noise_cutback_altitude'       ,   304.8  , (   240.    ,   400.   ) ,   304.8 ,    Units.meter],
    ])

    # -------------------------------------------------------------------
    #  Objective
    # -------------------------------------------------------------------

    problem.objective = np.array([

        [ 'noise_cumulative_margin', 17, Units.less ],

    ])


    # -------------------------------------------------------------------
    # Constraints
    # -------------------------------------------------------------------

    # [ tag, sense, edge, scaling, units ]
    problem.constraints = np.array([
        [ 'MZFW consistency' , '>' , 0. , 10 , Units.less],
        [ 'design_range_fuel_margin' , '>', 0., 10, Units.less],
        [ 'short_field_fuel_margin' , '>' , 0. , 10, Units.less],
        [ 'max_range_fuel_margin' , '>' , 0. , 10, Units.less], 
        [ 'wing_span' , '<', 35.9664, 35.9664, Units.less],
        [ 'noise_flyover_margin' , '>', 0. , 10., Units.less],
        [ 'noise_sideline_margin' , '>', 0. , 10. , Units.less],
        [ 'noise_approach_margin' , '>', 0., 10., Units.less],
        [ 'takeoff_field_length' , '<', 1985., 1985., Units.meters],
        [ 'landing_field_length' , '<', 1385., 1385., Units.meters],
        [ '2nd_segment_climb_max_range' , '>', 0.024, 0.024, Units.less],
        [ '2nd_segment_climb_short_field' , '>', 0.024, 0.024, Units.less],
        [ 'max_throttle' , '<', 1., 1., Units.less],
        [ 'short_takeoff_field_length' , '<', 1330., 1330., Units.meters],
        [ 'noise_cumulative_margin' , '>', 10., 10., Units.less],
    ])

    # -------------------------------------------------------------------
    #  Aliases
    # -------------------------------------------------------------------


    problem.aliases = [
        [ 'wing_area'                        ,   ['vehicle_configurations.*.wings.main_wing.areas.reference',
                                                  'vehicle_configurations.*.reference_area'                            ]],
        [ 'wing_aspect_ratio'                ,    'vehicle_configurations.*.wings.main_wing.aspect_ratio'               ],
        [ 'wing_incidence'                   ,    'vehicle_configurations.*.wings.main_wing.twists.root'                ],
        [ 'wing_tip_twist'                   ,    'vehicle_configurations.*.wings.main_wing.twists.tip'                 ],
        [ 'wing_sweep'                       ,    'vehicle_configurations.*.wings.main_wing.sweeps.quarter_chord'        ],
        [ 'wing_thickness'                   ,    'vehicle_configurations.*.wings.main_wing.thickness_to_chord'         ],
        [ 'wing_taper'                       ,    'vehicle_configurations.*.wings.main_wing.taper'                      ],
        [ 'wing_location'                    ,    'vehicle_configurations.*.wings.main_wing.origin[0]'                  ],
        [ 'horizontal_tail_area'             ,    'vehicle_configurations.*.wings.horizontal_stabilizer.areas.reference'],
        [ 'horizontal_tail_aspect_ratio'     ,    'vehicle_configurations.*.wings.horizontal_stabilizer.aspect_ratio'   ],
        [ 'vertical_tail_area'               ,    'vehicle_configurations.*.wings.vertical_stabilizer.areas.reference'  ],
        [ 'vertical_tail_aspect_ratio'       ,    'vehicle_configurations.*.wings.vertical_stabilizer.aspect_ratio'     ],
        [ 'design_thrust'                    ,    'vehicle_configurations.*.propulsors.turbofan.thrust.total_design'   ],
        [ 'MTOW'                             ,   ['vehicle_configurations.*.mass_properties.takeoff'   ,
                                                  'vehicle_configurations.*.mass_properties.max_takeoff'               ]],
        [ 'design_TOW'                       ,    'vehicle_configurations.base.mass_properties.takeoff'                 ],
        [ 'short_field_TOW'                  ,    'vehicle_configurations.short_field_takeoff.mass_properties.takeoff'  ],
        [ 'flap_takeoff_angle'               ,    ['vehicle_configurations.takeoff.wings.main_wing.flaps.angle',
                                                   'vehicle_configurations.short_field_takeoff.wings.main_wing.flaps.angle']],
        [ 'flap_landing_angle'               ,    'vehicle_configurations.landing.wings.main_wing.flaps.angle'          ],
        [ 'slat_takeoff_angle'               ,    ['vehicle_configurations.takeoff.wings.main_wing.slats.angle',
                                               'vehicle_configurations.short_field_takeoff.wings.main_wing.slats.angle']],
        [ 'slat_landing_angle'               ,    'vehicle_configurations.landing.wings.main_wing.slats.angle'          ],
        [ 'wing_span'                        ,    'vehicle_configurations.base.wings.main_wing.spans.projected'         ],
        [ 'noise_approach_margin'            ,    'summary.noise_approach_margin'                                       ],
        [ 'noise_sideline_margin'            ,    'summary.noise_sideline_margin'                                       ],
        [ 'noise_flyover_margin'             ,    'summary.noise_flyover_margin'                                        ],
        [ 'static_stability'                 ,    'summary.static_stability'                                            ],
        [ 'vertical_tail_volume_coefficient' ,    'summary.vertical_tail_volume_coefficient'                            ],
        [ 'horizontal_tail_volume_coefficient',   'summary.horizontal_tail_volume_coefficient'                          ],
        [ 'wing_max_cl_norm'                 ,    'summary.maximum_cl_norm'                                             ],
        [ 'design_range_fuel_margin'         ,    'summary.design_range_fuel_margin'                                    ],
#.........这里部分代码省略.........
开发者ID:michK,项目名称:SUAVE,代码行数:103,代码来源:Noise_Test.py


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