How to create a Simscape custom component with 2 different thermal liquids?

조회 수: 13 (최근 30일)
Dear all,
I am currently trying to create a custom component block for Simscape Thermal Liquid that models the heat transfer behaviour of a specific heat exchanger between two different thermal liquids. The code creates the block with no errors, nor warnings, and runs fine as long as I do not define thermal properties for both liquids. When I do define thermal properties for both liquids, I get the following error:
I imagine that the error comes from the fact that my code "expects" the 4 nodes (in/out for both liquids) to share properties, but I cannot find where that definition comes from...
Does anyone know how to define nodes that do not share fluid properties?
As a simpler test case, I am trying to make it work with a custom component block based on the Flow Rate Sensor (TL) library block, with 4 ports instead of 2. Same error comes up, but the code is much simpler to work with:
component flow_sensor_two_fluids
nodes
A = foundation.thermal_liquid.thermal_liquid; % A :left
B = foundation.thermal_liquid.thermal_liquid; % B :right
C = foundation.thermal_liquid.thermal_liquid; % C :left
D = foundation.thermal_liquid.thermal_liquid; % D :right
end
outputs
M1 = {0, 'kg/s'};
M2 = {0, 'kg/s'};
end
annotations
[M1] : Side=top
[M2] : Side=bottom
end
variables (Access = protected, ExternalAccess = none)
mdot1 = {0, 'kg/s'}; % Mass flow rate from port A to port B
Phi1 = {0, 'kW' }; % Energy flow rate from port A to port B
mdot2 = {0, 'kg/s'}; % Mass flow rate from port C to port D
Phi2 = {0, 'kW' }; % Energy flow rate from port C to port D
end
branches
mdot1 : A.mdot -> B.mdot;
Phi1 : A.Phi -> B.Phi;
mdot2 : C.mdot -> D.mdot;
Phi2 : C.Phi -> D.Phi;
end
equations
M1 == mdot1;
A.p == B.p;
A.T == B.T;
M2 == mdot2;
C.p == D.p;
C.T == D.T;
end
end
Thank you for your help!
PS: (I am aware that there already exists a heat exchanger (TL-TL) block that MathWorks provide, but would prefer to create my own)

채택된 답변

Yifeng Tang
Yifeng Tang 2024년 7월 29일
Hi Jérémie,
The error was complaining about that two stream of fluids are mixing into each other inside your heat exchanger :p
You'll need the modify our first line with this:
component (Propagation = blocks) flow_sensor_two_fluids
This way the domain parameters, including the fluids properties, will not be automatically shared among all the ports, as in most of fluid components. This may also mean that your A1-B1 / A2-B2 port are separated now in fluid properties. I think you can use an infinite flow resistance between them to propagate properties for each side.
See these two Documentation pages:
  댓글 수: 1
Jérémie
Jérémie 2024년 7월 30일
Hi Yifeng,
Thank you for your quick answer.
The modification to the 1st line, along with connecting infinite flow resistance between A1/B1 and A2/B2 work perfectly!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Thermal Liquid Library에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by