Error: No. of variables exceed no. of equations (how to count variables)

4 次查看(过去 30 天)
Here is my code for a counterflow water/water heat exchanger based on LMTD method.
The error which I am receiving is that no. of variables are exceeding the no. of equations. But I can't think of any equation which I missed as it is a very simple model. Can someone take a look at it and suggest any equation which I have missed.
________________________________________________
component counterflow_HX
% Heat Exchanger
% Ideal Counter flow heat exchanger based on LMTD method
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
Cp = { 4.2, 'J/g/K'}; % Specific heat
UA = { 0.34, 'J/s/K'}; % Product of heat transfer coefficient & area
end
variables
M1 = { 0.09, 'kg/s' }; % hot side mass flow
M2 = { 0.275, 'kg/s' }; % cold side mass flow
Phi1 = { 0, 'J/s' }; % hot side duty
Phi2 = { 0, 'J/s' }; % cold side duty
end
branches
M1 : A1.mdot -> B1.mdot;
M2 : A2.mdot -> B2.mdot;
Phi1: A1.Phi -> B1.Phi;
Phi2: A2.Phi -> B2.Phi;
end
equations
let
p_A1 = A1.p;
T_A1 = A1.T;
p_A2 = A2.p;
T_A2 = A2.T;
p_B1 = B1.p;
T_B1 = B1.T;
p_B2 = B2.p;
T_B2 = B2.T;
LMTD = ((T_A1 - T_B2) - (T_A2 - T_B1))/ (log ((T_A1 - T_B2) / (T_A2 - T_B1)));
in
Phi1 == M1 * Cp * (T_A1 - T_B1)
Phi2 == M2 * Cp * (T_A2 - T_B2)
Phi1 == Phi2
p_A1 == p_B1
p_A2 == p_B2
Phi1 == UA * LMTD
end
end
end
---------------------------------------------------------------
  3 个评论

请先登录,再进行评论。

采纳的回答

Drew Davis
Drew Davis 2015-6-22
It appears you are missing equations for the "M1" and "M2" variables. See this example.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Thermal Liquid Library 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by