Problem with custom simscape heat exchanger model

7 views (last 30 days)
I am trying to build a custom counter current heat exchanger model since I haven´t manage to use the one supplied properly (don´t have enough data and can´t achieve the values I want). The values that I get from the datasheet of the (plate) HX acording to a certain duty point are:
  • Temperature at inlet of both sides (TAin and TBin)
  • Pressure loss in both sides
  • Temperature at outlet of both sides (TAout and TBout)
  • Mass flow of both sides (MA, MB)
  • Specific capacity of both sides in the duty point (Cpa,Cpb)
  • Effective area (A) and overall heat exchange coefficient (U) (I supposed this are the values, the datasheet is in German but the calculation is ok)
I want to make a custom HX so i used the next code:
component cf_hx
% Heat Exchanger
% Ideal Counter flow heat exchanger
nodes
A1 = foundation.thermal_liquid.thermal_liquid; % A1:left
B1 = foundation.thermal_liquid.thermal_liquid; % B1:left
B2 = foundation.thermal_liquid.thermal_liquid; % B2:right
A2 = foundation.thermal_liquid.thermal_liquid; % A2:right
end
parameters
UA = { 35000, 'J/s/K'}; % Product of heat transfer coefficient & area
% cp1 = { 3.28*1000, 'J/kg/K'}; % Product of heat transfer coefficient & area
% cp2 = { 3.57*1000, 'J/kg/K'}; % Product of heat transfer coefficient & area
p1_loss = {0.1, 'MPa'}; % Pressure loss 1
p2_loss = {0.1, 'MPa'}; % Pressure loss 2
end
variables
M1 = { 11, 'kg/s' }; % hot side mass flow
M2 = { 11, 'kg/s' }; % cold side mass flow
end
% variables(Access=private)
% Q = { 70000, 'J/s' }; % hot side duty
% p1 = {0.1, 'MPa'}; % Pressure
% p2 = {0.1, 'MPa'}; % Pressure
% end
branches
M1 : A1.mdot -> B1.mdot;
M2 : A2.mdot -> B2.mdot;
end
function setup
% if R <= 0
% error( 'Resistance value must be greater than zero' );
% end
end
equations
let
% Domain parameters
T1_TLU = A1.T_TLU;
p1_TLU = A1.p_TLU;
cp1_TLU = A1.cp_TLU;
T2_TLU = A2.T_TLU;
p2_TLU = A2.p_TLU;
cp2_TLU = A2.cp_TLU;
% Across variables
p_A1 = A1.p;
p_A2 = A2.p;
T_A1 = A1.T;
T_A2 = A2.T;
p_B1 = B1.p;
p_B2 = B2.p;
T_B1 = B1.T;
T_B2 = B2.T;
% Liquid properties table lookup
% cp1 = tablelookup(T1_TLU, p1_TLU, cp1_TLU, T_A1, p_A1, interpolation=linear, extrapolation=linear);
% cp2 = tablelookup(T2_TLU, p2_TLU, cp2_TLU, T_A2, p_A2, interpolation=linear, extrapolation=linear);
cp1 = tablelookup(T1_TLU, p1_TLU, cp1_TLU, T_A1, p_A1, interpolation=linear, extrapolation=linear);
cp2 = tablelookup(T2_TLU, p2_TLU, cp2_TLU, T_A2, p_A2, interpolation=linear, extrapolation=linear);
C1 =M1*cp1;
C2 =M2*cp2;
Cmin = if C1<C2, C1 else C2 end;
Cmax = if C1>C2, C1 else C2 end;
Cr = Cmin/Cmax
NTU = UA/Cmin
epsilon = if Cr==1, NTU/(1+NTU) else (1-exp(-NTU*(1-Cr)))/(1-Cr*exp(-NTU*(1-Cr))) end;
Qmax=Cmin*(T_A1 - T_A2)
Q = epsilon * Qmax;
in
Q == C1 * (T_A1 - T_B1);
-Q == C2 * (T_A2 - T_B2);
% p1 == p_A1 -p1_loss- p_B1;
% p2 == p_A2 -p2_loss- p_B2;
end
end
end
This is no more that the equations for a counter current HX using E-NTU method. If i add the equations for the pressure loss (currently in comments) it says that number of equations is greater than number of variables. Right now doesn´t simulate and says that the temperature downstream is 0 wich raises an error. The other thing is that I can not define different properties for both sides of the HX. I am thinking of just using two pipes and a lot of sensors to drive the heat exchange but i would like to make a custom model for learning also. Anybody has any ideas how to go about this? Thx

Answers (1)

Andrew Schenk
Andrew Schenk on 21 Sep 2016
Edited: Andrew Schenk on 21 Sep 2016
You will need to add four variables and corresponding branch statements for the energy flow rate, Phi at each node. The branch statements should be of the form A1.Phi -> *; as this will give you full control over writing the conservation equations. Look at the following Simscape source file as an example:
>> edit foundation.thermal_liquid.two_port_steady
When you add the four Phi variables, you will need to add four additional equations to maintain the same number of equations and unknowns. In addition to the two commented pressure loss equations, you will need to add energy balance equations. See the following documentation for an idea of what equations may be missing:
Regarding the different fluid properties, you will need to set the attribute Propagation = blocks in your component. See the following documentation for more information:

Categories

Find more on Foundation and Custom Domains in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!