How can I assamble n identical blocks in a simscape simulation automathically?

1 次查看(过去 30 天)
Hello,
I am trying to simulate the thermal behaviour of a pipe with high resolution detail, and as such I want to divide my pipe in n segments and simulate the heat transfer through the wall of each segment separately. I tried to use Pipe(TL) from SimscapeFluids_lib/Thermal Liquid/Pipes & Fittings but only one temperature output is available. I tried to modify the code of this element but could not get it.
I decided then to create a new block with a pipe Pipe (TL) from fl_lib/Thermal Liquid/Elements adding all insulation layers and then put n of those elements in series to do the simulations. I would like to know if its possible to do this through code, since n could easily reach values of 100 or so. I've browsed through the documentation but found no reference to this.
The idea is to simulate somthing like this:
With n elements like these emulating the pipe:
Thank you.

采纳的回答

Fangjun Jiang
Fangjun Jiang 2023-12-15
  1. It is possible. Use add_block() to construct the blocks, but repeating 100 times in one model doesn't sound reasonable.
  2. Because these elements are connected in series, "For Each Subsystem" block can't be used.
  3. For your problem, it sounds like Finite Element Analysis. Refer to this article
  4. https://www.mathworks.com/discovery/finite-element-analysis.html
  1 个评论
ANTÓN
ANTÓN 2023-12-18
Thank you for your answer,
I agree that repeating the blocks graphically in one model is not the ideal solution. I think modifying the code of the pipe to obtain the temperatures at intermediate points is a much better idea, but I have no access to that code (maybe I should fully recreate the code of the pipe).
Thank you for the "add_block()" tip. I need to investigate it a little bit more, but I think it could be useful.
Doing a Finite Element Analysis is also possible, but it is not what I am looking for. I simplified my problem to ask the question, but this is just the starting point of my analysis. It is not feasible to do it using Finite Elements.

请先登录,再进行评论。

更多回答(1 个)

Yifeng Tang
Yifeng Tang 2024-1-2
In addition to @Fangjun Jiang's suggestion on add_block(), I would encourage you to also look into the "composite component" option in Simscape language. You may add multiple simscape blocks and connect them programmatically, and they can appear to be one single Simscape block. You can use for loops to add many components, and use "component array" to make thing manageable.
More details:
  2 个评论
ANTÓN
ANTÓN 2024-1-10
This is exactly what I had in mind. Thank you very much for this contribution.
So far I created a subsystem with 10 components and replicated it 10 times. This works for a static analysis but is not suitable for an optimization process. I will definitly look into these functions.
Yifeng Tang
Yifeng Tang 2024-1-10
编辑:Yifeng Tang 2024-1-10
As you start on this route, check out the subsystem2ssc function as well. It builds a composite component from a subsystem model, which can help you start with a template and save some time.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Two-Phase Fluid Library 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by