How to represent a volume in Simulink which is divided into 1000 smaller volumes, i.e. discretization in time and space?
4 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(2 个)
Doug Eastman
2011-2-24
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.
Kaustubha Govind
2011-2-24
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!