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.
How do I programmatically find all physical modeling networks?
조회 수: 1 (최근 30일)
이전 댓글 표시
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개)
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');
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete Events and Mode Charts에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!