How do I programmatically find all physical modeling networks?

조회 수: 1 (최근 30일)
Chris Rygaard
Chris Rygaard 2017년 1월 29일
댓글: Chris Rygaard 2022년 2월 21일
Is there an automatic way to discover all of the physical modeling networks in a Simulink block diagram?
I'm managing a large project in which I am receiving models from several engineers for integration into a system-level simulation. When integrating the models, I need to connect several physical modeling networks between the subsystem models. Once I have the models connected, I need to track down all of the physical modeling networks to determine which ones are missing a solver configuration block or have an extra solver configuration block.
Currently I am doing this by analyzing the model and parsing the error messages, which is quite time consuming. Unfortunately, I have to do this (and a lot of other work) every time one of the contributing engineers submits an updated model.
I think I could partially automate this effort if I could find a way to discover all of the networks in the integrated model. If I could write a script to generate a list of the networks, I think I could then write another script that would could go through the generated list, and for each network in the list:
(1) get a list of the blocks in the network,
(2) inspect the blocks to make sure there is exactly one solver configuration block, and
(3) add/remove solver configuration blocks as needed.
I think I could even automate setting the parameters in the solver configuration blocks, but that is a different discussion.
Does anybody have any ideas on how I would do this?
Thanks,
Chris
P.S. The approach outlined above is my best guess at a solution to the problem. If somebody has a better approach, I'd like to hear it.
  댓글 수: 1
Chris Rygaard
Chris Rygaard 2022년 2월 21일
A late follow-up. I was able to implement an automated solution by discovering all of the blocks and following all of the connections between the blocks.

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

답변 (1개)

Michelle Wu
Michelle Wu 2017년 1월 31일
You can programmatically find systems, blocks, lines, ports, and annotations by using function "find_system". For instance, if you have an integrated model named "myModel", the following code will allow you to find a list of all Simscape blocks within your model, including those in the SubSystems of the model:
sys = 'myModel';
load_system(sys)
sscBlks = find_system(sys,'BlockType','SimscapeBlock');
However, please note that the "BlockType" of a Solver Configuration block is "SubSystem" rather than "SimscapeBlock", and thus they won't be in the above list. In order to find all the Solver Configuration blocks, use the following command:
solverConfigs = find_system(sys,'ReferenceBlock','nesl_utility/Solver Configuration');
  댓글 수: 1
Chris Rygaard
Chris Rygaard 2017년 2월 1일
That finds all of the Simscape blocks in the model, but not the networks. I'm trying to create a list of the distinct networks.

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

카테고리

Help CenterFile Exchange에서 Troubleshooting에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by