% =========================================================================
% Parameters for the Simulink model of the Brobekk plant.
% =========================================================================

clear all

% Hot/cold streams
rho_h = 914;		% Hot stream density [kg/m3] (T = 153 C)
rho_c = 955;        % Cold stream density [kg/m3] (T = 105 C)
rho_air = 1.161;    % Air density [kg/m3] (p = 1 bar, T = 300 K)
h_h	= 3.902;		% Heat transfer coefficient, hot side [kW/m2*K]
h_c = 3.902;        % Heat transfer coefficient, cold side [kW/m2*K]
cp_h = 4.2667;		% Heat capacity, hot stream [kJ/kg*K]
cp_c = 4.2667;      % Heat capacity, cold stream [kJ/kg*K]
cp_air = 1.007;     % Heat capacity, air [kJ/kg*K] (p = 1 bar, T = 300 K)
Th_in = 180;        % Temperature in hot stream in [C]
Tc_in = 70;         % Temperature in cold stream in [C]
Tc_air_in = 10;     % Temperature in cold air stream in [C]
wh_in = 250000/3600;    % Mass flow rate, Brobekk cycles [kg/s]
wc_in = 600000/3600;    % Mass flow rate, Viken cycle [kg/s]

% Heat exchangers
% -------------------------------------------------------------------------
% General data
A = 227;            % Heat transfer area [m2]
A = A*0.30617048025;        % Corrected heat transfer area to give Q = 16 MW [m2]
Vh_tot = 3*0.0889;  % Hot side volume [m3]      (From Vahterus Oy)
Vc_tot = 3*0.1164;  % Cold side volume [m3]     (From Vahterus Oy)
N = 10;				% Number of cells

% Hot side
V_i_h = Vh_tot/N;	% Hot side cell volume [m3]
A_i_h = A/N;        % Hot side cell area [m2]

% Cold side
V_i_c = Vc_tot/N;	% Cold side cell volume [m3]
A_i_c = A/N;		% Cold side cell area [m2]

% Wall
V_w = A*0.005;      % Wall volume [m3] (assuming 5 mm thickness)
rho_w = 8030;       % Wall density [kg/m3] (AISI 304)
cp_w = 0.503;       % Wall heat capacity [kJ/kg*K] (AISI 304)
V_i_w = V_w/N;		% Volume of a single wall segment [m3]
A_i_w = A/N;		% Area of a single wall segment [m2]

% Cooling units
% -------------------------------------------------------------------------
% General data
h_h_ut = h_h;           % Heat transfer coefficient, hot side [kW/m2*K]
h_c_ut = h_c;           % Heat transfer coefficient, cold side [kW/m2*K]

% Hot side
V_i_h_ut = V_i_h;       % Hot side cell volume [m3]
A_i_h_ut = A_i_h;       % Hot side cell area [m2]

% Cold side
V_i_c_ut = V_i_c;       % Cold side cell volume [m3]
A_i_c_ut = A_i_c;       % Cold side cell area [m2]

% Wall
rho_w_ut = rho_w;       % Wall density [kg/m3] (AISI 304)
cp_w_ut = cp_w;         % Wall heat capacity [kJ/kg*K] (AISI 304)
V_i_w_ut = V_i_w;       % Volume of a single wall segment [m3]
A_i_w_ut = A_i_w;       % Area of a single wall segment [m2]

% Initial conditions
%--------------------------------------------------------------------------
% Heat exchangers - Initial temperatures
Th0 = [173.5;167.3;161.4;155.7;150.2;144.9;139.9;135.1;130.4;126]; % Hot side
Tc0 = [72.06;74.2;76.44;78.77;81.2;83.74;86.38;89.13;92.01;95];    % Cold side
Tw0 = [134.3;129.7;125.3;121;117;113.1;109.3;105.8;102.3;99.03];   % Wall

% Cold utilities - Initial temperatures
Th0_ut = [173.5;167.3;161.4;155.7;150.2;144.9;139.9;135.1;130.4;126]; % Hot side
Tc0_ut = [72.06;74.2;76.44;78.77;81.2;83.74;86.38;89.13;92.01;95];    % Cold side
Tw0_ut = [134.3;129.7;125.3;121;117;113.1;109.3;105.8;102.3;99.03];   % Wall