 # Delivered to the U.S. Government in Accordance with Contract FA8650-10-C-7080.
 #
 # EXPORT CONTROLLED
 # ECCN#   EAR99  
 # Warning:  This document contains technical data which is controlled under the
 # Bureau of Industry & Security’s Export Administration Regulations and may not be
 # exported or re-exported without authorization by the Bureau of Industry & Security.
 # Diversion contrary to US law is prohibited.
 #
 # (c) 2011 United Technologies Corp.
 # Developed with the sponsorship of the Defense Advanced Research Projects Agency (DARPA).
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy of this data,
 # including any software or models in source or binary form, as well as any drawings, 
 # specifications, and documentation (collectively "the Data"), to deal in the Data without 
 # restriction, including without limitation the rights to use, copy, modify, merge, publish,
 # distribute, sublicense, and/or sell copies of the Data, and to permit persons to whom the Data
 # is furnished to do so, subject to the following conditions:
 #  
 # The above copyright notice and this permission notice shall be included in all copies or
 # substantial portions of the Data.
 #  
 # THE DATA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
 # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, SPONSORS, DEVELOPERS, CONTRIBUTORS, OR
 # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE
 # USE OR OTHER DEALINGS IN THE DATA.

######## Objectives:
param NumEngines_p;
param aircraftweight_p;
param altitude_p;
param M_in_p;
param Thto = aircraftweight_p*0.25/NumEngines_p;
param IsentropicEfficiency_compressor_p = Nc10;
param Efficiency_turbine_p = Nt10;
param total_fuel_p = 0.25*aircraftweight_p;


var NumEngines>=1;
var aircraftweight>=1000;
var cruisedistance>=100;
var altitude>=0;
var M_in>=0.1;
var Thrust_Takeoff_Req>=1000;
var IsentropicEfficiency_compressor >=0.1;
var Efficiency_turbine >=0.1;


var BPR>=2; 
var OPR>=2;
var TSFC>=0.01;
var total_fuel>=500;
var m_core>=0.1; 


subject to conNumEngines: NumEngines = NumEngines_p;									# Change to variable for output purposes
subject to conaircraftweight: aircraftweight=aircraftweight_p;								# Change to variable for output purposes
subject to concruisedistance: cruisedistance = M_in_p*sqrt(1.4*R*(288-6.5*altitude_p/1000))*3600/(1.85*10^3)/(TSFC)*20*0.28;			# Output cruise distance in nautical miles						# Change to variable for output purposes
subject to conaltitude: altitude=altitude_p;										# Change to variable for output purposes
subject to conM_in_p: M_in = M_in_p;											# Change to variable for output purposes
subject to conThrust_Takeoff_Req: Thrust_Takeoff_Req = Thto;
subject to conIsentropicEfficiency_compressor: IsentropicEfficiency_compressor = IsentropicEfficiency_compressor_p;	# Change to variable for output purposes
subject to conEfficiencyTurbine_turbine: Efficiency_turbine = Efficiency_turbine_p;					# Change to variable for output purposes

subject to conobjectiveBPR: BPR= bpr;											# Change name to output format
subject to conobjectiveOPR: OPR = Po_out_compressor10/Pac;								# Change name to output format
subject to conobjectiveTSFC: TSFC = mfuel/Thto*3.5305*10^4*1.8;								# Correction factor for TSFC cruise calculated using aggregated results from Gasturb11

subject to conobjectivetotal_fuel:total_fuel=total_fuel_p;								# Change to variable for output purposes

subject to contobjectivem_core: m_core = ma_core;									# Change name to output format
 
minimize objective: mfuel/Thto;