def optimize_aircraft(m, substitutions, fixedBPR=False, pRatOpt=True, mutategparg=False, x0 = None): """ Optimizes an aircraft of a given configuration :param m: aircraft model with objective and configuration :param fixedBPR: boolean specifying whether or not BPR is fixed (depends on config) :param pRatOpt: boolean specifying whether or not pressure ratio is optimized (depends on config) :param mutategparg: boolean whether to keep each GP solve intact :return: solution of aircraft model """ if fixedBPR: substitutions.update({ '\\alpha_{max}': 6.97, #8.62, }) if pRatOpt: del substitutions['\pi_{f_D}'] del substitutions['\pi_{lc_D}'] del substitutions['\pi_{hc_D}'] m.substitutions.update(substitutions) m_relax = Model(m.cost, BCS(m)) m_relax = relaxed_constants(m_relax) sol = m_relax.localsolve(verbosity=4, iteration_limit=200, reltol=0.01, mutategp=mutategparg, x0 = x0) post_process(sol) return sol
def run_optimal_737(objective, fixedBPR, pRatOpt, mutategparg): # User definitions Nclimb = 3 Ncruise = 2 Nmission = 1 aircraft = 'optimal737' m = Mission(Nclimb, Ncruise, objective, aircraft, Nmission) substitutions = get737_optimal_subs() if Nmission == 4: substitutions.update({ 'R_{req}': [ 3000. * units('nmi'), 2500. * units('nmi'), 2000. * units('nmi'), 1000. * units('nmi') ], #,2500.*units('nmi') 'n_{pass}': [180., 180., 180., 180.], #, 140. }) elif Nmission == 2: substitutions.update({ 'R_{req}': [ 3000. * units('nmi'), 2000. * units('nmi'), ], #,2500.*units('nmi') 'n_{pass}': [180., 180.], #, 140. }) else: substitutions.update({ 'R_{req}': 3000. * units('nmi'), 'n_{pass}': 180., }) if fixedBPR: substitutions.update({ '\\alpha_{max}': 6.97, }) if pRatOpt: #del substitutions['\pi_{f_D}'] del substitutions['\pi_{lc_D}'] del substitutions['\pi_{hc_D}'] m.substitutions.update(substitutions) m = Model(m.cost, BCS(m)) m_relax = relaxed_constants(m, None, ['M_{takeoff}', '\\theta_{db}']) sol = m_relax.localsolve(verbosity=1, iteration_limit=200, reltol=0.01, mutategp=mutategparg) #post_process(sol) #percent_diff(sol, 'b737800', Nclimb) #post_compute(sol, Nclimb) return sol
def run_D8_no_BLI(objective, fixedBPR, pRatOpt, mutategparg): # User definitions Nclimb = 3 Ncruise = 2 Nmission = 1 aircraft = 'D8_no_BLI' m = Mission(Nclimb, Ncruise, objective, aircraft, Nmission) substitutions = get_D8_no_BLI_subs() if Nmission > 1: substitutions.update({ 'R_{req}': [3000. * units('nmi'), 2500. * units('nmi')], 'n_{pass}': [180., 180.], }) else: substitutions.update({ 'R_{req}': 3000. * units('nmi'), 'n_{pass}': 180., }) if fixedBPR: substitutions.update({ '\\alpha_{max}': 6.97, }) if pRatOpt: del substitutions['\pi_{f_D}'] ## del substitutions['\pi_{lc_D}'] ## del substitutions['\pi_{hc_D}'] m.substitutions.update(substitutions) m = Model(m.cost, BCS(m)) m_relax = relaxed_constants(m, None, ['M_{takeoff}', '\\theta_{db}']) sol = m_relax.localsolve(verbosity=4, iteration_limit=200, reltol=0.01, mutategp=mutategparg) post_process(sol) percent_diff(sol, 'D82', Nclimb) post_compute(sol, Nclimb) return sol
def run_optimal_777(objective, fixedBPR, pRatOpt, mutategparg): # User definitions Nclimb = 3 Ncruise = 2 Nmission = 1 aircraft = 'optimal777' m = Mission(Nclimb, Ncruise, objective, aircraft, Nmission) substitutions = get_optimal_777300ER_subs() substitutions.update({ 'R_{req}': 6000., 'n_{pass}': 450., }) if fixedBPR: substitutions.update({ '\\alpha_{max}': 8.62, }) if pRatOpt: del substitutions['\pi_{f_D}'] ## del substitutions['\pi_{lc_D}'] ## del substitutions['\pi_{hc_D}'] m.substitutions.update(substitutions) m = Model(m.cost, BCS(m)) m_relax = relaxed_constants(m, None, ['M_{takeoff}', '\\theta_{db}']) sol = m_relax.localsolve(verbosity=4, iteration_limit=200, reltol=0.01, mutategp=mutategparg) post_process(sol) percent_diff(sol, 'b777300ER', Nclimb) post_compute(sol, Nclimb) return sol