How do I programmatically find all physical modeling networks?

1 visualizzazione (ultimi 30 giorni)
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 Commento
Chris Rygaard
Chris Rygaard il 21 Feb 2022
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.

Accedi per commentare.

Risposte (1)

Michelle Wu
Michelle Wu il 31 Gen 2017
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 Commento
Chris Rygaard
Chris Rygaard il 1 Feb 2017
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.

Accedi per commentare.

Categorie

Scopri di più su Discrete Events and Mode Charts in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by