def setup(): nexus = Nexus() problem = Data() nexus.optimization_problem = problem # ------------------------------------------------------------------- # Inputs # ------------------------------------------------------------------- # [ tag , initial, (lb,ub) , scaling , units ] problem.inputs = np.array([ ['wing_area', 61., (50.0, 72.0), 61., Units.meter**2], ['aspect_ratio', 12., (10., 14.), 12.0, Units.less], ['t_c_ratio', 0.15, (0.11, 0.18), 0.15, Units.less], # ['sweep_angle', 3., (0., 10.0), 3.0, Units.deg], # ['taper_ratio', 0.53, (0.53, 0.53), 1., Units.less], ['cruise_range', 331.3, (310., 350.), 331.3, Units.nautical_miles], ['delta_fuel', 8.8, (0., 80.), 40., Units.kg], # MTOW consistency # ['beta', 1., (1., 1.), 1., Units.less], ]) # ------------------------------------------------------------------- # Objective # ------------------------------------------------------------------- # throw an error if the user isn't specific about wildcards # [ tag, scaling, units ] problem.objective = np.array([ # ['Nothing', 1., Units.kg], ['objective', 10., Units.less], ]) # ------------------------------------------------------------------- # Constraints # ------------------------------------------------------------------- # [ tag, sense, edge, scaling, units ] # CONSTRAINTS ARE SET TO BE BIGGER THAN ZERO, SEE PROCEDURE (SciPy's SLSQP optimization algorithm assumes this form) problem.constraints = np.array([ # ['design_range_margin', '=', 0., 100., Units.nautical_miles], # Range consistency ['fuel_margin_ub', '>', 0., 1000., Units.kg], # MTOW consistency ['fuel_margin_lb', '>', 0., 1000., Units.kg], # MTOW consistency ['Throttle_min', '>', 0., 1., Units.less], ['Throttle_max', '>', 0., 1., Units.less], ['tofl_mtow_margin', '>', 0., 100., Units.m], # take-off field length # ['mzfw_consistency', '>', 0., 1000., Units.kg], # MZFW consistency ['design_range_ub', '>', 0., 1., Units.nautical_miles], # Range consistency ['design_range_lb', '>', 0., 1., Units.nautical_miles], # Range consistency ['time_to_climb', '>', 0., 10., Units.min], # Time to climb consistency ['climb_gradient', '>', 0., 1., Units.less], # second segment climb gradient ['lfl_mlw_margin', '>', 0., 100., Units.m], # landing field length ['max_fuel_margin', '>', 0., 1000., Units.kg], # max fuel margin # ['range_HH_margin', '>', 0., 1000., Units.nautical_miles], # Range for Hot and High ['TOW_HH_margin', '>', 0., 1000., Units.kg], # TOW for Hot and High # ['MTOW', '>', 0., 100000., Units.kg], # TOW for Hot and High # ['BOW', '>', 0., 1., Units.kg], # TOW for Hot and High ]) # ------------------------------------------------------------------- # Aliases # ------------------------------------------------------------------- # [ 'alias' , ['data.path1.name','data.path2.name'] ] problem.aliases = [ ['wing_area', ['vehicle_configurations.*.wings.main_wing.areas.reference', 'vehicle_configurations.*.reference_area' ]], ['aspect_ratio', 'vehicle_configurations.*.wings.main_wing.aspect_ratio' ], ['taper_ratio', 'vehicle_configurations.*.wings.main_wing.taper' ], ['t_c_ratio', 'vehicle_configurations.*.wings.main_wing.thickness_to_chord' ], ['sweep_angle', 'vehicle_configurations.*.wings.main_wing.sweeps.quarter_chord'], ['cruise_range', 'missions.base.segments.cruise.distance' ], ['delta_fuel', 'vehicle_configurations.base.delta_fuel' ], ['Nothing', 'summary.nothing' ], # ['fuel_burn', 'summary.base_mission_fuelburn' ], ['fuel_margin_ub', 'summary.fuel_margin_ub' ], ['fuel_margin_lb', 'summary.fuel_margin_lb' ], ['Throttle_min', 'summary.throttle_min' ], ['Throttle_max', 'summary.throttle_max' ], ['tofl_mtow_margin', 'summary.takeoff_field_length_margin' ], ['mzfw_consistency', 'summary.mzfw_consistency' ], # ['design_range_margin', 'summary.design_range_margin'], ['design_range_ub', 'summary.design_range_ub' ], ['design_range_lb', 'summary.design_range_lb' ], ['time_to_climb', 'summary.time_to_climb' ], ['climb_gradient', 'summary.climb_gradient' ], ['lfl_mlw_margin', 'summary.lfl_mlw_margin' ], ['max_fuel_margin', 'summary.max_fuel_margin' ], # ['range_HH_margin', 'summary.range_HH_margin'], ['TOW_HH_margin', 'summary.TOW_HH_margin'], # ['MTOW', 'summary.MTOW'], # ['BOW', 'summary.BOW'], ['beta', 'vehicle_configurations.base.wings.main_wing.beta'], ['objective', 'summary.objective'], ] # ------------------------------------------------------------------- # Vehicles # ------------------------------------------------------------------- nexus.vehicle_configurations = Vehicles.setup() # ------------------------------------------------------------------- # Analyses # ------------------------------------------------------------------- nexus.analyses = Analyses.setup(nexus.vehicle_configurations) nexus.analyses.vehicle = Data() nexus.analyses.vehicle = nexus.vehicle_configurations.base # ------------------------------------------------------------------- # Missions # ------------------------------------------------------------------- nexus.missions = Missions.setup(nexus.analyses) # ------------------------------------------------------------------- # Procedure # ------------------------------------------------------------------- nexus.procedure = Procedure.setup() # ------------------------------------------------------------------- # Summary # ------------------------------------------------------------------- nexus.summary = Data() nexus.total_number_of_iterations = 0 nexus.beta = Data() nexus.beta = 1. return nexus
def setup(): nexus = Nexus() problem = Data() nexus.optimization_problem = problem # ------------------------------------------------------------------- # Inputs # ------------------------------------------------------------------- # [ tag , initial, (lb,ub) , scaling , units ] problem.inputs = np.array([ ['wing_area', 68.35899318, (65.0, 80.0), 75., Units.meter**2], ['aspect_ratio', 9.423509209, (7.6, 9.8), 9.8, Units.less], ['t_c_ratio', 0.139063312, (0.09, 0.15), 0.13, Units.less], ['sweep_angle', 30., (18.0, 30.0), 30.0, Units.deg], [ 'cruise_range', 1114.55358764, (1000., 1160.), 1130.0, Units.nautical_miles ], ['MTOW', 36777.7116079, (35000., 39000.), 37200., Units.kg], ['MZFW_ratio', 0.812216071, (0.7, 0.9), 0.9, Units.less], ]) # ------------------------------------------------------------------- # Objective # ------------------------------------------------------------------- # throw an error if the user isn't specific about wildcards # [ tag, scaling, units ] problem.objective = np.array([ # ['fuel_burn', 10000., Units.kg], ['objective', 1., Units.less], ]) # ------------------------------------------------------------------- # Constraints # ------------------------------------------------------------------- # [ tag, sense, edge, scaling, units ] # CONSTRAINTS ARE SET TO BE BIGGER THAN ZERO, SEE PROCEDURE (SciPy's SLSQP optimization algorithm assumes this form) problem.constraints = np.array([ ['mzfw_consistency', '=', 0., 100., Units.kg], # MZFW consistency ['fuel_margin', '=', 0., 100., Units.kg], # fuel margin defined here as fuel ['Throttle_min', '>', 0., 1., Units.less], ['Throttle_max', '>', 0., 1., Units.less], ['tofl_mtow_margin', '>', 0., 100., Units.m], # take-off field length ['design_range_ub', '>', 0., 10., Units.nautical_miles], # Range consistency ['design_range_lb', '>', 0., 10., Units.nautical_miles], # Range consistency ['time_to_climb', '>', 0., 10., Units.min], # Time to climb consistency ['climb_gradient', '>', 0., 1., Units.less], # second segment climb gradient ['lfl_mlw_margin', '>', 0., 100., Units.m], # landing field length ['max_fuel_margin', '>', 0., 100., Units.kg], # max fuel margin ['TOW_HH_margin', '>', 0., 100., Units.kg], # TOW for Hot and High ]) # ------------------------------------------------------------------- # Aliases # ------------------------------------------------------------------- # [ 'alias' , ['data.path1.name','data.path2.name'] ] problem.aliases = [ [ 'wing_area', [ 'vehicle_configurations.*.wings.main_wing.areas.reference', 'vehicle_configurations.*.reference_area' ] ], [ 'aspect_ratio', 'vehicle_configurations.*.wings.main_wing.aspect_ratio' ], [ 't_c_ratio', 'vehicle_configurations.*.wings.main_wing.thickness_to_chord' ], [ 'sweep_angle', 'vehicle_configurations.*.wings.main_wing.sweeps.quarter_chord' ], ['cruise_range', 'missions.base.segments.cruise.distance'], ['fuel_margin', 'summary.fuel_margin'], ['Throttle_min', 'summary.throttle_min'], ['Throttle_max', 'summary.throttle_max'], ['tofl_mtow_margin', 'summary.takeoff_field_length_margin'], ['mzfw_consistency', 'summary.mzfw_consistency'], ['design_range_ub', 'summary.design_range_ub'], ['design_range_lb', 'summary.design_range_lb'], ['time_to_climb', 'summary.time_to_climb'], ['climb_gradient', 'summary.climb_gradient'], ['lfl_mlw_margin', 'summary.lfl_mlw_margin'], ['max_fuel_margin', 'summary.max_fuel_margin'], ['TOW_HH_margin', 'summary.TOW_HH_margin'], [ 'MTOW', [ 'vehicle_configurations.*.mass_properties.max_takeoff', 'vehicle_configurations.*.mass_properties.takeoff' ] ], ['MZFW_ratio', 'summary.MZFW_ratio'], ['beta', 'vehicle_configurations.base.wings.main_wing.beta'], ['objective', 'summary.objective'], ] # ------------------------------------------------------------------- # 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 nexus.beta = Data() nexus.beta = 1. return nexus