Simulink: Is there an easy way to replicate a sub-system in the same simulation?

I have a simulation composed of several interconnected subsystems, and I wish extend this to simultaneously, but independently, simulate the same process, but in the reverse direction.
I know that I can copy & paste my existing blocks, then manually rename the variables, gotos, etc.
Wondering if there is a simple and easy way to do this where these are renamed automatically (maybe adding pre-/suffix to the existing names)?
I've tried to keep this general, as I think any answer would apply whatever you might be doing with simulink, but am happy to provide any and all details, if it will help someone find an easier solution.

 채택된 답변

Sebastian Castro
Sebastian Castro 2015년 7월 31일
You can automate this using a script. Some relevant functions include:
  • add_block to add and copy blocks, as well as position them
  • add_line to connect blocks together
  • set_param to rename blocks or change block parameters e.g. Goto/From tag names
- Sebastian

댓글 수: 3

Thanks Sebastian, this sounds a lot easier. I'm guessing there is also a way to programmatically obtain a list of all param's in a given block, and all block's in a given subsystem, then I could do this recursively from the top down... otherwise it's almost as onerous as manually changing things.
Have you done anything like this before? and possibly have any other advice to simplify? Thanks, -Daniel
I've done a little bit of this. I know that people generally use these techniques to string together multiple repetitive blocks, for example, strings of battery cells or finite-element models.
You can use "find_system" to do your search of blocks inside a subsystem... or even to search for the subsystems themselves.
To get a list of all block parameters, you can do:
>> get_param(blockName,'ObjectParameters');
- Sebastian
Thanks, I thought this would be a lot more complicated. I was looking at about 150 individual params needing to be changed and, although I could invest the time to do it manually if needed, I assumed there must be an easier way.
Daniel

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Subsystems에 대해 자세히 알아보기

제품

질문:

2015년 7월 30일

댓글:

2015년 7월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by