% %Heat exchanger sizing 

%This script sizes all the heat exchangers based on the information from
%the main steady state simulation. 
%filename='./res/T0m100q100.mat';
filename='SSresults.mat';
load (filename)

Ts = T;
% MR Precooler
% Assumes sea water (T = 298.15 K)  
Twater = 298.15;
[ UA_MR,  NTU_A, NTU_B ] = hxsizing( QHA_01, Ts(1), Ts(2), Twater, Twater )

% HA_01
% Cooling temperature Neskaa et al 2010 (T= - 44C)
Tethylene = 273.15 - 44; 
[ UA_HA_01,  NTU_A, NTU_B ] = hxsizing( QHA_01, Ts(2), Ts(3), Tethylene, Tethylene )

% HA-02
[ UA_HA_02,  NTU_A, NTU_B ] = hxsizing( QHA_02, Ts(5), Ts(6), Ts(15), Ts(16) )

% HA-04
[ UA_HA_04,  NTU_A, NTU_B ] = hxsizing( QHA_04, Ts(6), Ts(8), Ts(12), Ts(13) )

% HA-07
%BOG Temperatures from BOG.m 
TBOGin = -32 + 273.15; %Inlet temperature [K]
TBOGout = -154 +273.15; %Outlet temperature [K]

[ UA_HA_07  ] = hxsizing( -QHA_07, Ts(11), Ts(14), TBOGin, TBOGout)

% Save data to file

filename='HXSizing.mat';
save(filename, 'UA_MR', 'UA_HA_01', 'UA_HA_02', 'UA_HA_04', 'UA_HA_07')
