Error: No. of variables exceed no. of equations (how to count variables)
显示 更早的评论
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 个评论
Abhiram Bhanuprakash
2015-6-22
Hi Muhammad Zain,
The code which you have posted does not look like MATLAB code. Can you tell which language it is, and what is the relation between this and MathWorks products?
Abhiram
Muhammad Zain Haider Ali
2015-8-20
Andreas
2015-10-15
Could you share the working code?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Foundation and Custom Domains 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!