Difficulties in creating a simscape component : "Number of variables exceeds number of equations"

14 次查看(过去 30 天)
Hello everybody,
I try to create my own simscape component using Thermal Liquid language.
My goal is to build a simple air cooled heat exchanger component that removes part of the energy contained in the liquid.
Parameters of the component :
the ambient temperature (°K)
specific power (kW/K) (Pspé)
Through this component, there are conservation of the mass flow rate and the conservation of the energy with those equations :
Qa + Qb + Pdissip = 0
Pdissip = Pspé * (Ta -Tamb)
Qa, Qb input and output power of node a and b ; Ta the temperature of inlet.
so I wrote this code which does not work :
component radiator
% Radiator (TL) : 1.5
nodes
A = foundation.thermal_liquid.thermal_liquid; % A:left
B = foundation.thermal_liquid.thermal_liquid; % B:right
end
parameters
Tamb = {293.15,'K'}; % Température ambiante
Puissance_spe = {0.5,'kW/K'}; % Puissance dissipé spécifique
end
% Parameter checks
equations
assert(Tamb > 0)
assert(Puissance_spe > 0)
end
variables (Access = protected)
% Through variables
mdot_A = {0, 'kg/s'}; % Mass flow rate into port A
mdot_B = {0, 'kg/s'}; % Mass flow rate into port B
Phi_A = {0, 'kW' }; % Energy flow rate into port A
Phi_B = {0, 'kW' }; % Energy flow rate into port B
end
branches
mdot_A : A.mdot -> *; %
mdot_B : B.mdot -> *;
Phi_A : A.Phi -> *;
Phi_B : B.Phi -> *;
end
intermediates
P_dissip = Puissance_spe * ( A.T - Tamb );
end
equations
% Mass balance
mdot_A + mdot_B == 0;
% Energy balance
Phi_A + Phi_B + P_dissip == 0;
end
end
The error from my simscape model is as follow :
-------------------------------
Error compiling Simscape network for model Hydraulique.
Caused by:
Component:Simulink | Category:Model error
---------------------------------
in the first instance, I want to build the simplest component with a minimum of equation and then to complexify afterwards
Thank you in advance for your answer.

回答(1 个)

Avadhoot
Avadhoot 2023-10-31
Hi Quentin,
I understand that you created a Simscape component and are facing an error with it.
In a physical system, it is important to have the number of equations equal to or greater than the number of variables. In your component, you have defined four variables: "mdot_A", "mdot_B", "Phi_A", and "Phi_B". However, you have only specified two equations in the system. This mismatch between the number of variables and equations is causing the error.
To resolve this issue, you need to specify additional equations that describe more constraints within the system. For example, you can add equations that link "mdot_A" to "Phi_A" and "mdot_B" to "Phi_B".
I hope this helps.

类别

Help CenterFile Exchange 中查找有关 Foundation and Custom Domains 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by