%% Process parameters for RunCSTRmod.m

global p c i

% Cp interpolation, from enthalpy Temperature diagram
% Linear approximation h = K_1 +aT
p.beta = 0.68;
p.a_NPK1 = ((32-9.5)/(42-32)*1000)*p.beta;   %J/kgK 
p.a_H2O1 = 4183;                    %J/kgK
p.alfa = 2.22;                        %Fitting parameter
p.gamma = 1;

% Steady state calculation of U
p.A = (6.31-3.580+3.23-0.4)*1.515*128*2*p.gamma; % Total heat exchanger area. m2
% NB 3 not confirmed height* width* plates
p.Ai = p.A/i.n; %Area per section m2
%p.Ui = (210000/60 *(0.38*4.1)*(2))/(p.Ai*(2))
p.U = ((i.n_WR_W*4183*15)/(p.A*((c.T_R-6)-c.T_cmid)))*p.alfa;
      % (m3/h*kg/m3/(min/h*s/min*J/kgK*K))/(m2*K) = J/sm2K

%Testing
x_temp = [25 32  34 34 40 42 54];        % Temperature
y_enth = [0 9.5 13 23 30 33 50];        % Enthalpy
p.a_NPKbot = ((13-0)/(33-25)*1000*p.beta);
p.a_NPKphase = ((23-13)/(34-33)*1000*p.beta);
p.a_NPKtop = ((50-23)/(54-34)*1000*p.beta);