why have i this error: "Number of equations exceeds number of variables."

6 visualizaciones (últimos 30 días)
leclercq
leclercq el 26 de Nov. de 2012
Respondida: Yifeng Tang el 8 de Jun. de 2022
hello all,
i modelize a thermal and hydraulic system and when I count number of variables and equations, I have 18 variables, 16 equations and i get an error:"Number of equations exceeds number of variables." . i can reduce it to 14 variables and 14 equations but i have the same error.
here is the code of my personnal blocks and a picture of my system.
component chaudierepompe
% Chaudiere+pompe
% Ce bloc représente une chaudiere couplée avec une pompe.
inputs
R = { 0, 'J/s' }; % R:bottom
S = { 0, 'm^3/s' }; % S:bottom
end
nodes
A = foundation.thermal.thermal; % A:bottom
B = foundation.thermal.thermal; % B:top
F = foundation.hydraulic.hydraulic; % F:bottom
G = foundation.hydraulic.hydraulic; % G:top
end
variables
q = { 1, 'm^3/s' };
Q = { 1 , 'J/s' };
end
parameters
Cp = { 4180, 'J/kg/K' }; % Cp eau
rho = { 1000, 'kg/m^3' }; % Rho de l'eau
end
function setup
through( q, F.q, G.q );
through( Q, A.Q, B.Q );
end
equations
q == S;
Q == R;
end
end
component echangeur
% Echangeur
% Ce composant va modéliser un echangeur de chaleur.
nodes
A = foundation.thermal.thermal; % :left
B = foundation.hydraulic.hydraulic; % :left
C = foundation.thermal.thermal; % :left
D = foundation.hydraulic.hydraulic; % :left
E = foundation.thermal.thermal; % :right
F = foundation.hydraulic.hydraulic; % :right
G = foundation.thermal.thermal; % :right
H = foundation.hydraulic.hydraulic; % :right
end
parameters
Cp = { 4180, 'J/(kg*K)' }; % Cp eau
rho = { 1000, 'kg/m^3' }; % Rho eau
Tini = { 343.15, 'K' }; % Temperature initiale de l'eau
Rdmnt = { 1, '1' }; % Rendement de l'échangeur
Pe = { 1000000, 'J/s' }; % Puissance échangeur
end
variables
q1 = { 0, 'm^3/s' };
q2 = { 0, 'm^3/s' };
end
function setup
through( q1, B.q, D.q );
through( q2, H.q, F.q );
C.T = Tini;
E.T = Tini;
end
equations
Pe * Rdmnt == q1 * rho * Cp * (A.T - C.T);
Pe * Rdmnt == q2 * rho * Cp * (E.T - G.T);
end
end
component debitgen
% Generateur de debit
inputs
S = { 0, 'm^3/s' }; % S:bottom
end
nodes
T = foundation.hydraulic.hydraulic; % T:bottom
P = foundation.hydraulic.hydraulic; % P:top
end
variables
q = { 1 , 'm^3/s' };
end
function setup
through( q, T.q, P.q );
end
equations
q == S;
end
end
component Consomateur
% Consomateur
% Ce composant symbolise un consomateur de chaleur.
nodes
M = foundation.thermal.thermal; % :top
U = foundation.hydraulic.hydraulic; % :top
N = foundation.thermal.thermal; % :bottom
V = foundation.hydraulic.hydraulic; % :bottom
end
parameters
Cp = { 4180, 'J/(kg*K)' }; % Cp eau
rho = { 1000, 'kg/m^3' }; % rho de l'eau
Qcons = { 1000, 'J/s' }; % Puissance consommée
resistance = { 5000 'Pa/(m^3/s)' }; % resistance lineique consomateur
Tini = { 343.15, 'K' }; %Temperature initiale
end
variables
q = { 0, 'm^3/s' };
p = { 0, 'Pa' };
end
function setup
through( q, U.q, V.q );
across ( p, U.p, V.p );
N.T = Tini;
end
equations
Qcons == q * rho * Cp * (M.T - N.T);
p == resistance * q;
end
end
P.S: i have more problems when I do my own hydro-thermal domain. So I use the 2 domain thermal and hydraulic.
What can i do to solve this error?
Thanks for your responses.

Respuestas (1)

Yifeng Tang
Yifeng Tang el 8 de Jun. de 2022
10 years after when the question was asked ... the thermal liquid domain should be able to handle the thermal+hydraulic application you described. It's first introduced in R2013b, I think. The library has been expanding since then, and the Simscape Fluids add-on library now also contains various valves and heat exchanger blocks.

Categorías

Más información sobre Foundation and Custom Domains en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by