% 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.
% 

clear all
clc

cd('..')
cd('Map Processing Efficient')
load('AutoLoad.mat')
cd('..')
cd ('3 SP Turbofan Efficient')

Mach = 0.8;
T_1 = 389.8943;
P_1 = 1.5847e+05;
w_high = 2926.2;
beta_new = 0.4962;

D_HPC = [3000 15.134 14 0.9 0.5 398.43 166304.28] ;
global gam_cold 

gam_cold = 1.4;

num_samples = 2000;

sigma_T1 = 12;
sigma_P1 = 600;
sigma_M = .0289;

a = sqrt(3)*sigma_T1;
T1 = T_1-a + 2*a*rand(num_samples,1);

a = sqrt(3)*sigma_P1;
P1 = P_1 - a + 2*a*rand(num_samples,1);

a = sqrt(3)*sigma_M;
Mach = Mach-a + 2*a*rand(num_samples,1);


[T2, P2, G2, Speed_HPC_current, Power_HPC] = HPC(T1, P1, w_high, beta_new, Mass_HPC_Tr, PR_HPC_Tr, Efficiency_HPC_Tr, D_HPC);

plot(T1,P1,'.b',T2,P2,'r.');

epa_hpc = ( std(T2)/mean(T2) + std(P2)/mean(P2) + ...
    + std(G2)/mean(G2) + std(Speed_HPC_current)/mean(Speed_HPC_current) ...
    + std(Power_HPC)/abs(mean(Power_HPC)) ) / ...
    ( std(P1)/mean(P1) + std(T1)/mean(T1) ) 



hpc_output = [T2, P2, G2, Speed_HPC_current, Power_HPC];




