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

4 views (last 30 days)
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 Comments
Muhammad Zain Haider Ali
Muhammad Zain Haider Ali on 20 Aug 2015
Abhiram, This is the SIMSCAPE language, which used to model physical systems.

Sign in to comment.

Accepted Answer

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

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!