How to create a Simscape custom component with 2 different thermal liquids?
15 次查看(过去 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)
0 个评论
采纳的回答
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:
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Thermal Liquid Library 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!