How to represent a volume in Simulink which is divided into 1000 smaller volumes, i.e. discretization in time and space?

4 Ansichten (letzte 30 Tage)
hi, I am trying to implement some dynamics in the pipe in Simulink. The idea is to divide a volume of the pipe into 1000 smaller intervals (blocks) with the same length. Each interval would have its own properties like pressure, density, viscosity etc. which will be transferred from interval to interval. An equation of state and continuity equation are implemented in each interval. I have done already a model by dividing a pipe into 20 smaller volumes and it works good, but it was done manually through connecting each volume step by step. Is there any way of implementing these 1000 cells? I was thinking about having a loop block with the matlab script in it and inputing it into my simulink model. Another way, which is not that practical, could be to copy-paste all the time, for example, firstly 20 smaller volumes and making them 40, then taking those 40 volumes and making them 80 and so on till 1000. Another question is how it is possible to apply certain parameters to all similar blocks at once. For ex, applying the same time delay of 2000 sec to 40 “variable transport delay” blocks. Thank you.

Antworten (2)

Doug Eastman
Doug Eastman am 24 Feb. 2011
One approach to creating and connecting all the elements would be to write a MATLAB script to programmatically build up the Simulink model. Seth has a blog post that goes over this idea: Building Models with MATLAB Code.
As for applying the same time delay to 40 different blocks, the easiest approach is to use a variable as the time delay parameter, for example, 'delayTime'. Then you can simply change the value of that one variable in MATLAB and all the blocks will reference this new value.
If you've already added the blocks and need to change the parameters, the best approach is to use the Model Explorer. This blog post goes into some details on that: Model Explorer for Data Management.
  1 Kommentar
Rustem Nafikov
Rustem Nafikov am 25 Feb. 2011
Thank you a lot! I will try to do it. Especially, thanks to the advice in naming all the parameters instead of inputing numbers. I was actually using this technique for other blocks, but didn't think about this easy way now.))

Melden Sie sich an, um zu kommentieren.


Kaustubha Govind
Kaustubha Govind am 24 Feb. 2011
If each of the volumes (or a set of volumes) has identical properties, you may want to consider using the For Each Subsystem. Unfortunately, it is currently not possible to apply different parameters for each iteration - only the inputs can change.

Kategorien

Mehr zu General Applications finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by