% Delivered to the Government in Accordance with Contract FA8650-10-C-7080
% 
%  (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.
% 


load('../Map Processing/AutoLoadAll.mat');

% load('../Map Processing/AutoLoad.mat');


% Create Interpolant
Mass_Fan_Tr_mat = [Beta_Fan_t, Speed_Fan_t, Mass_Fan_t];
PR_Fan_Tr_mat = [Beta_Fan_t, Speed_Fan_t, PR_Fan_t];
Efficiency_Fan_Tr_mat = [Beta_Fan_t, Speed_Fan_t, Efficiency_Fan_t];

Mass_LPC_Tr_mat = [Beta_LPC_t, Speed_LPC_t, Mass_LPC_t];
PR_LPC_Tr_mat = [Beta_LPC_t, Speed_LPC_t, PR_LPC_t];
Efficiency_LPC_Tr_mat = [Beta_LPC_t, Speed_LPC_t, Efficiency_LPC_t];

Mass_HPC_Tr_mat = [Beta_HPC_t, Speed_HPC_t, Mass_HPC_t];
PR_HPC_Tr_mat = [Beta_HPC_t, Speed_HPC_t, PR_HPC_t];
Efficiency_HPC_Tr_mat = [Beta_HPC_t, Speed_HPC_t, Efficiency_HPC_t];

Mass_HPT_Tr_mat = [Beta_HPT_t, Speed_HPT_t, Mass_HPT_t];
PR_HPT_Tr_mat = [Beta_HPT_t, Speed_HPT_t, PR_HPT_t];
Efficiency_HPT_Tr_mat = [Beta_HPT_t, Speed_HPT_t, Efficiency_HPT_t];

Mass_IPT_Tr_mat = [Beta_IPT_t, Speed_IPT_t, Mass_IPT_t];
PR_IPT_Tr_mat = [Beta_IPT_t, Speed_IPT_t, PR_IPT_t];
Efficiency_IPT_Tr_mat = [Beta_IPT_t, Speed_IPT_t, Efficiency_IPT_t];

Mass_LPT_Tr_mat = [Beta_LPT_t, Speed_LPT_t, Mass_LPT_t];
PR_LPT_Tr_mat = [Beta_LPT_t, Speed_LPT_t, PR_LPT_t];
Efficiency_LPT_Tr_mat = [Beta_LPT_t, Speed_LPT_t, Efficiency_LPT_t];

% 
% 
% 
% plot3(Mass_Fan_Tr(:,1),Mass_Fan_Tr(:,2),Mass_Fan_Tr(:,3))

% f = @(x,y) F(x , y+zeros(size(x)) )

nc_fan = 0;
f = @(x,y) Mass_Fan_Tr(x,y + zeros(size(x)) );
nc_fan = nc_fan + dblquad(f,0,1,0.4,1.1);
f = @(x,y) PR_Fan_Tr(x,y + zeros(size(x)) );
nc_fan = nc_fan + dblquad(f,0,1,0.4,1.1);
f = @(x,y) Efficiency_Fan_Tr(x,y + zeros(size(x)) );
nc_fan = nc_fan + dblquad(f,0,1,0.4,1.1);


nc_lpc = 0;
f = @(x,y) Mass_LPC_Tr(x,y + zeros(size(x)) );
nc_lpc = nc_lpc + dblquad(f,0,1,0.4,1.1);
f = @(x,y) PR_LPC_Tr(x,y + zeros(size(x)) );
nc_lpc = nc_lpc + dblquad(f,0,1,0.4,1.1);
f = @(x,y) Efficiency_LPC_Tr(x,y + zeros(size(x)) );
nc_lpc = nc_lpc + dblquad(f,0,1,0.4,1.1);

nc_hpc = 0;
f = @(x,y) Mass_HPC_Tr(x,y + zeros(size(x)) );
nc_hpc = nc_hpc + dblquad(f,0,1,0.6,1);
f = @(x,y) PR_HPC_Tr(x,y + zeros(size(x)) );
nc_hpc = nc_hpc + dblquad(f,0,1,0.6,1);
f = @(x,y) Efficiency_HPC_Tr(x,y + zeros(size(x)) );
nc_hpc = nc_hpc + dblquad(f,0,1,0.6,1);


nc_hpt = 0;
f = @(x,y) Mass_HPT_Tr(x,y + zeros(size(x)) );
nc_hpt = nc_hpt + dblquad(f,0,1,0.9,1.1);
f = @(x,y) PR_HPT_Tr(x,y + zeros(size(x)) );
nc_hpt = nc_hpt + dblquad(f,0,1,0.9,1.1);
f = @(x,y) Efficiency_HPT_Tr(x,y + zeros(size(x)) );
nc_hpt = nc_hpt + dblquad(f,0,1,0.9,1.1);
% 
% 
nc_ipt = 0;
f = @(x,y) Mass_IPT_Tr(x,y + zeros(size(x)) );
nc_ipt = nc_ipt + dblquad(f,0,1,0.6,1.1);
f = @(x,y) PR_IPT_Tr(x,y + zeros(size(x)) );
nc_ipt = nc_ipt + dblquad(f,0,1,0.6,1.1);
f = @(x,y) Efficiency_IPT_Tr(x,y + zeros(size(x)) );
nc_ipt = nc_ipt + dblquad(f,0,1,0.6,1.1);


nc_lpt = 0;
f = @(x,y) Mass_LPT_Tr(x,y + zeros(size(x)) );
nc_lpt = nc_lpt + dblquad(f,0,1,0.7,1.2);
f = @(x,y) PR_LPT_Tr(x,y + zeros(size(x)) );
nc_lpt = nc_lpt + dblquad(f,0,1,0.7,1.2);
f = @(x,y) Efficiency_LPT_Tr(x,y + zeros(size(x)) );
nc_lpt = nc_lpt + dblquad(f,0,1,0.7,1.2);


nc_1spT = nc_hpc + nc_hpt 

nc_2spT = nc_hpc + nc_hpt + nc_lpc + nc_lpt

nc_25spT = nc_hpc + nc_hpt + nc_lpc + nc_lpt + nc_fan

nc_3spT = nc_hpc + nc_hpt + nc_lpc + nc_lpt + nc_fan + nc_ipt

nc_5spT = nc_hpc + nc_hpt + 3*nc_lpc + nc_lpt + nc_fan + 3*nc_ipt

nc_12spT = nc_hpc + nc_hpt + 10*nc_lpc + nc_lpt + nc_fan + 10*nc_ipt














